nested if statement
-
Ive had a google about nexted if statements but failing to find what i need, or just am not awake to find it :laugh: So here is an example of what i need help with
if textbox1.text = "example" then
if textbox2.text = "another example then
so on.....END IF
I have done it it java just not sure in VB, in a quick way, when system runs the if statement, if the first if passes then go onto the second if statement. Could anyone help me out on the correct syntax?
-
Ive had a google about nexted if statements but failing to find what i need, or just am not awake to find it :laugh: So here is an example of what i need help with
if textbox1.text = "example" then
if textbox2.text = "another example then
so on.....END IF
I have done it it java just not sure in VB, in a quick way, when system runs the if statement, if the first if passes then go onto the second if statement. Could anyone help me out on the correct syntax?
You seem on the right path, I don't understand the statement..
If x = 1 Then
If y = 2 Then
If z = 3 Then
z = 4
y = 5
x = 6
End If
End If
End IfAssume x = 1 y = 2 z = 4 Then the
first two If statements pass
astrue
but the last If statement, the test onif z = 3 fails
, so x,y and z never get changed past 1,2 and 4 respectively. Did this help?Check out the CodeProject forum Guidelines[^] The original soapbox 1.0 is back![^]
-
You seem on the right path, I don't understand the statement..
If x = 1 Then
If y = 2 Then
If z = 3 Then
z = 4
y = 5
x = 6
End If
End If
End IfAssume x = 1 y = 2 z = 4 Then the
first two If statements pass
astrue
but the last If statement, the test onif z = 3 fails
, so x,y and z never get changed past 1,2 and 4 respectively. Did this help?Check out the CodeProject forum Guidelines[^] The original soapbox 1.0 is back![^]
-
you should also notice how proper indentation improves readability a lot. Most code editors can do that automatically for you. :)
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.