sneeri_c
asked on
If - Then - And
VB.NET 2005.
If I have the following IF statement:
If DirCheckFunc(DirPath1) and DirCheckFunc(DirPath2) Then
-Do this
Else
MsgBox ("Something Here")
End If
Basically, the DirCheckFunc is a function returning a True or False for each one DirPath1 and DirPath2. In the MsgBox for the Else portion, I would like to identify the one that caused the statement to be False. How do or can I determine which one caused it to be false without having to check each one again.
Thanks
If I have the following IF statement:
If DirCheckFunc(DirPath1) and DirCheckFunc(DirPath2) Then
-Do this
Else
MsgBox ("Something Here")
End If
Basically, the DirCheckFunc is a function returning a True or False for each one DirPath1 and DirPath2. In the MsgBox for the Else portion, I would like to identify the one that caused the statement to be False. How do or can I determine which one caused it to be false without having to check each one again.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
easy as this....
dim tResult1 as boolean=DirCheckFunc(DirPa th1)
dim tResult2 as boolean =DirCheckFunc(DirPath2)
If tResult1 and tResult2 Then
-Do this
Else
MsgBox ("Result1 = " & result1 & vbcrlf & "Result2 = " & result2)
End If
oh, just realised this is basically what jimhorn said (although he does have a minor error)... ah well post anyway... ;-)
dim tResult1 as boolean=DirCheckFunc(DirPa
dim tResult2 as boolean =DirCheckFunc(DirPath2)
If tResult1 and tResult2 Then
-Do this
Else
MsgBox ("Result1 = " & result1 & vbcrlf & "Result2 = " & result2)
End If
oh, just realised this is basically what jimhorn said (although he does have a minor error)... ah well post anyway... ;-)
Thanks for the grade. Good luck with your project. -Jim
-Do this
Else
if DirCheckFunc(DirPath1) = false then
MsgBox ("DirPath1 is false")
elseif DirCheckFunc(DirPath2) = false then
MsgBox ("DirPath2 is false")
end if
End If