Visual Basic problem (very noob)
hi all,
i have decided to learn VB and the first program in the book already gives problems:
Code:
Private Sub Command1_Click()
Image1.Visible = False
Label1.Caption = Int(Rnd * 10)
Label2.Caption = Int(Rnd * 10)
Label3.Caption = Int(Rnd * 10)
If (Label1.Caption = 7) And (Label2.Caption = 7) And _
(Label3.Caption = 7) Then Image1.Visible = True
Beep
End If
End Sub
It is giving the error End If without block If
it should be about the same as:
Code:
if((Label1.Caption ==7)&&(Label2.Caption==7)&&(Label3.Caption))
{
Image1.Visible=TRUE;
Beep;
}
(nice huh? C and VB in one code :D). this is what it should look like, but then in VB....
This is really bothering me, VB should be such an easy language, and i know C, but still i do not understand what i have done wrong!!!
ps i'm using VB 6.0 pro as compiler, and i did try the above code with and without the '_' underscore.