|
-
August 1st, 2001, 03:40 PM
#1
"in" operator in VB?
Hi,
Is there any Operator like "in" in VB which have the similar function as in SQL?
What I want to do is:
if x="a" or x="b" or x="c" then
'do something
end if
May I use this:
if x in ("a","b","c") then
'do something
end if
Thanks!
Regards,
Michi
MCSE, MCDBA
-
August 1st, 2001, 03:46 PM
#2
Re: "in" operator in VB?
Try this maybe...
Select Case x
case "a" or "b" or "c":
'do something
End Select
-
August 1st, 2001, 03:49 PM
#3
Re: "in" operator in VB?
Yes, it is a work around if there is no such operator. Thanks.
Regards,
Michi
MCSE, MCDBA
-
August 6th, 2001, 07:17 AM
#4
Re: "in" operator in VB?
Like = is a new Vb6 operator
ie:
if x like "[a-b-c]" or x like "[A-B-C]" then
end if
-
August 7th, 2001, 02:08 AM
#5
Re: Correct sintax for Like
'this does work
private Sub Command1_Click()
Dim vntIn
vntIn = InputBox("input a letter")
If vntIn Like "[A-C]" then
MsgBox "input= A,B or C"
ElseIf vntIn Like "[DEFabc]" then
MsgBox "input = D,E,F, a,b or c"
ElseIf vntIn Like "*#" then
MsgBox "input: a keystroke and a number"
End If
End Sub
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
August 7th, 2001, 11:32 AM
#6
Re: Correct sintax for Like
Thanks for your suggestion. But I think the "Like" operator does not very useful when the selective strings have no comparison part except for the meanings. For example, how can we use "like" to translate the following:
If x in ("cat", "dog", "fish") then .....
Anyway, thanks again.
Regards,
Michi
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
|