Click to See Complete Forum and Search --> : Visual Basic HELP


Freedom65
10-11-2000, 05:28 PM
Hey guys, I need your help. I am a newbie in VB and needa know how to use the "CASE" statements properly....Also, a few easy examples would be appreciated!

Thank you.

thane
10-13-2000, 04:43 AM
umm, not trying to state the obvious but have you tried looking at the help files ? They have an example for pretty much every command, I know there is one for the CASE command.


------------------
/At least I have a positive attitude about my destructive habits/

thane
10-13-2000, 04:44 AM
Just to save you time here's the VB example.


Dim Number
Number = 8 ' Initialize variable.
Select Case Number ' Evaluate Number.
Case 1 To 5 ' Number between 1 and 5.
Debug.Print "Between 1 and 5"
' The following is the only Case clause that evaluates to True.
Case 6, 7, 8 ' Number between 6 and 8.
Debug.Print "Between 6 and 8"
Case Is > 8 And Number < 11 ' Number is 9 or 10.
Debug.Print "Greater than 8"
Case Else ' Other values.
Debug.Print "Not between 1 and 10"

End Select

Freedom65
10-13-2000, 03:12 PM
Oh, I know how now....Thanks......


BTW, I don't have MSDN but I am gonna get a VB book this weekend.

Schmitty
10-17-2000, 03:53 PM
Anyone know of a good visual basic site?
I'm taking a class in it right now. I'm on reading a file fixing the words and making it all initial caps for every word and deleting non chars. Having a little trouble.

frankmccann
10-21-2000, 06:01 PM
http://www.dcs.napier.ac.uk/hci/VB50/home.html

Originally posted by Freedom65:
Hey guys, I need your help. I am a newbie in VB and needa know how to use the "CASE" statements properly....Also, a few easy examples would be appreciated!

Thank you.

krixk
10-28-2000, 09:27 AM
Hi:

If you plan to use VB for a longer period of time I'd recommend a book. For instance "Mastering VB" - Sybex.
I've been using it for two years...

Krixk

GHz
10-28-2000, 04:59 PM
The case statement is a test condition that is the opposit of the if statement.
Lets say we have a text box on a form named txtName.Text
and you wanted to test for a couple of numbers lets say 666 and 1790.
The syntax would be

Select Case txtName.Text

Case 666
msgbox"You have the my favorite number"

Case 1790
msgbox"You have the right number"

Case Else
msgbox"Sorry try again"
End Select

''-------------------------------------------
Select Case txtName.Text(the condition that will be tected)

Case 666
msgbox"You have the my favorite number"(If the text inside "txtName.Text" is = to 666 then the program will give you a message box that will tell you that 666 is my favorite number.)


Case 1790
msgbox"You have the right number"
If the value of txtName.Text =1790 then
then the program will give you a message box that will tell you that 1790 You have the right number)

If neither 1790 or 666 is entered the program will give
msgbox"Sorry try again"
End Select( ends the Case Statement)

wozster
10-30-2000, 05:02 PM
http://www.planetsourcecode.com

Originally posted by Schmitty:
Anyone know of a good visual basic site?
I'm taking a class in it right now. I'm on reading a file fixing the words and making it all initial caps for every word and deleting non chars. Having a little trouble.

Vancaeyzeele
11-03-2000, 04:18 PM
Another example in VBScript tough:
users.pandora.be/caey/

look at the source, it is a multimedia sequencer and the selct case stuff is around the 1/3 of the page

BoogyMan
11-03-2000, 08:06 PM
If you guys are doing this for a living, subscribe to TechNet.

It is, at times, my right hand...


------------------
Happy Halloween, Ladies!

blazn
11-05-2000, 10:40 PM
here r some good vb info sites:
www.vbsquare.com (http://www.vbsquare.com) www.vbhelp.com/ubbcgi/ultimate.cgi (http://www.vbhelp.com/ubbcgi/ultimate.cgi) www.vbcode.com (http://www.vbcode.com)
cuinl.tripod.com/tips-and-tricks.htm

also in IRC
server: forums.vbchat.com
channel: #vbchat