need some suggestions

  • Thread starter Thread starter cj
  • Start date Start date
C

cj

I'm looking for a simple case type construct like IIF but that'll handle
3 possibilities. I doubt this is possible but?????
 
cj said:
I'm looking for a simple case type construct like IIF but that'll handle
3 possibilities. I doubt this is possible but?????

Check out VB's 'Choose' and 'Switch' functions.
 
Both suggestions are precisely what I was looking for and I remember
them now. Switch will work best this time.

I do wish instead of switch working like this:

Switch(CityName = "London", "English", _
CityName = "Rome", "Italian", CityName = "Paris", "French")

It worked more like this:

Switch(CityName =, "London", "English", _
"Rome", "Italian", "Paris", "French")

I find myself having to repeat myself over and over in VB lately. Maybe
it's always been the case but It just seems that it's been more often
since I got started with VB.net.

Hummm, now that I wrote that I kinda wish the Select Case structure did
allow me repeat myself. Cause I was just complaining the other day I
couldn't say something like:

Select Case
Case state = "VA"
messagebox.show("I'm sorry VA residents are not eligible.")
Case address1.substring(0, 6) = "PO BOX"
messagebox.show("PO boxes are not valid.")
Case else
Console.WriteLine("Congratulations! You could be a wiener!")
End Select

I guess there is just no pleasing me. :)

Thanks again for the excellent suggestions!
 
Back
Top