|
-
June 22nd, 2009, 01:26 PM
#1
using Or statement
can someone help me im trying to use the Or statement in a project
i have a checkbox which gets checked when i click a label then i want to see if when a cmd button is clicked weather the outcome is in the fist 10 numbers or the second. bit like a roulette table
the code i have which isnt working(that i need help on) is this
Code:
Private Sub lblEndResult_Change()
if Check1(0).Value = 1 then
if lblEndResult.Caption >0 Or <10 then
MsgBox "Number is Less Than 10",vbOkOnly, "Less Than 10"
end if
end if
End Sub
now when i try to use this code it comes up in red telling me its not gonna work. why?
can i not use the Or statement here.
-
June 22nd, 2009, 01:32 PM
#2
Re: using Or statement
Change to
if lblEndResult.Caption >0 Or lblEndResult.Caption<10 then
but I think you want an And instead of the Or
-
June 22nd, 2009, 01:37 PM
#3
Re: using Or statement
ThankYou It Worked A Treat.
-
June 22nd, 2009, 01:58 PM
#4
Re: using Or statement
I would add another bit to this condition
Code:
If Val(lblEndResult.Caption) > 0 Or Val(lblEndResult.Caption) < 10 Then
This way, I would be sure that even if there is a string the caption my program won't crash. You can test your code by putting a non-numeric Caption to the label and see how it blows up.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|