|
-
Nov 19th, 2001, 01:19 AM
#1
Thread Starter
Addicted Member
= this or that question (string)
Hi,
I have a have several strings that are only unique by the last 3 characters and I need to put in an if statement.
However I am having trouble with it:
If not Right (listbox1, 3) = "123" OR "234" or "345" then
DoWhatever
End if
You should notice that the above code doesn't work. (As I just found out). I need it to be able to do what the above code says in plain english (not vb terms). So basically if it doesn't match any of those then it goes to DoWhatever. I could do this with multiple If-Else-End if statements, but I'm wondering if there is a way to do this similar to the provided code? Am I missing some keyword? (tried a lot of them too).
Thanx in advance,
Scott
Error... What Error?!?! I've only typed a single character!
______________________________
VB 6.0 EE, Win 2k Pro on AMD Duron 1Ghz/ 384 MB SDRAM
-
Nov 19th, 2001, 01:25 AM
#2
Frenzied Member
maybe commas instead of OR im probly wrong tho i havent learned about the OR staement yet
-
Nov 19th, 2001, 01:25 AM
#3
Addicted Member
VB Code:
If Not (Right(myStr, 3) = "123" Or Right(myStr, 3) = "234" Or "345") Then
'Do Whatever
End If
The Left side of the operator = has to be given everytime
-
Nov 19th, 2001, 01:26 AM
#4
Frenzied Member
-
Nov 19th, 2001, 01:29 AM
#5
Fanatic Member
okay try doing this
VB Code:
Dim strData As String
strData = Right(list1.List(1),3)
'In your code you did not specify the listbox list index that you
'wanted to use you will probably need to place some code a for
'next statement to encapsualte this code and step through your
'list or something depending what you want to do
Select Case StrData
Case Is = "123", "234", 345"
'your stuff here
Case Else
'If no match here
End Select
-
Nov 19th, 2001, 01:29 AM
#6
Addicted Member
Originally posted by Motoxpro
aaaaaw...
Did my reply pinch u or what
-
Nov 19th, 2001, 01:36 AM
#7
Frenzied Member
-
Nov 19th, 2001, 04:22 AM
#8
Conquistador
VB Code:
StrData = Right(myStr, 3)
If Not StrData = "123" Or Not StrData = "234" Or Not StrData = "345" Then
'Do Whatever
End If
I think that should also work
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
|