Click to See Complete Forum and Search --> : The IF statement
GiD
Nov 4th, 1999, 06:48 AM
I will probably get laughed out of this forum but I need to know how to check for more than on thing in an IF statement.
Ex. if richtextbox1.text = ^6,^7,^8,^9 then
whatever...
I don't want to have to nest if statements if at all possible. Please help.
GiD
QWERTY
Nov 4th, 1999, 06:56 AM
You could use OR Operator.
With Text1
If .Text = "^6" Or .Text = "^7" Then
'Do whatever you want
End If
End With
'you don't have to use With statement
'it just makes code look less
'complicated to me (and shorter too)
Hope this will help
------------------
Visual Basic Programmer
-----------------
PolComSoft
You will hear a lot about it.
[This message has been edited by QWERTY (edited 11-04-1999).]
Ghost
Nov 4th, 1999, 06:58 AM
Use OR keyword.
If something = "BLAH" or something = "MORE BLAH" Then
do something.
End if
If you can multiple different cases you want to check you can also user Select Case.
SELECT CASE richtextbox1.txt
CASE 1
do something
CASE 2
do something
CASE 6,7,8,9
do something
END SELECT
GiD
Nov 4th, 1999, 07:44 AM
Thanks a lot guys. I had a brain fart there! :)
GiD
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.