Non-AppFrame Question


Author
Message
Ben Kim
Ben Kim
StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)
Group: Forum Members
Posts: 99, Visits: 253
Also, since I am new to VB.NET and coming from Clarion, is there a way to check a single field for specific values instead of a long IF statement or Select...Case?

Example in Clarion:

IF INLIST(MyField, "Male", "Female", "Both")
    MESSAGE("Valid")
ELSE
    MESSAGE("INVALID")
END

In Clarion I could test for multiple values with a single statement as shown above (I believe up to 25 values at a time).  Is there a similar statement in VB.NET?  Currently I have code like:

IF MyField <> "Male" AND MyField <> "Female" AND MyField <> "Both"
...
END

Thank you for any ideas!

Ben

Replies
Ben Kim
Ben Kim
StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)
Group: Forum Members
Posts: 99, Visits: 253
Would I just Dim lcItem per your example as follows?

Dim lcItem As String

Sorry for the newbie questions!

Ben

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Yes.  You can also do it inline.

For Each lcItem As String IN TestItems
Next

Either case will work.  Steve's example is also a very good idea as well if you don't need to do any internal processing.  The only problem with using the IndexOf may be case-sensitivity.  Otherwise it is definitely the quickest route.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search