Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if

Status
Not open for further replies.

Blobishthing

Programmer
Feb 16, 2002
23
AU
When i try to run my program an error comes up saying that there are can be no End If block if ther is no If block but i have got an If block any way hear is the code:

If RichTextBox1.Text = "Left" And Image1.Picture = LoadPicture(App.Path + "\Pics\start.bmp") Then X = "(X)-2"
End If
 
There are 2 ways to use the If statement:

If x > y Then y = 0
'or
If x > y Then
y = 0
End If

Only the second way requires an End If, because the Then keyword is followed by the end of the line. In ur code it looks like you've merged the two. You should either get rid of the End If altogether, or change it to this:

If RichTextBox1.Text = "Left" And Image1.Picture = LoadPicture(App.Path + "\Pics\start.bmp") Then
X = "(X)-2"
End If

Good luck!

~Mike
Now and then it's good to pause in our
pursuit of happiness and just be happy.

- Guillaume Apollinaire
 
If yourcondition Then
' statements to execute s/b on new line after If...Then
X = "(X)-2"
End If

or

If yourcondition Then: X = "(X)-2" ' without End If (note ':')
 
I made a booboo, disregard my post
particularly the part about the ":"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top