A Programmers thoughts
Archive for April, 2010
Using Select Case in Vb.Net
Apr 28th
It’s been a long time since I did not update my blog but now I’m here again to discuss all about on how to use Select Case in Vb. Net. I know It is very simple to understand because it is very basic but let me post it here to guide some people that are new in vb.net. Here is my example below.
In a form, put 1 textbox and 1 button and in a click button event paste the following code…
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
Dim Girl As String
Dim KindOfGirl As String
Girl = TextBox1.Text
Select Case Girl
Case “1″
KindOfGirl = “Fat”
Case “2″
KindOfGirl = “Sexy”
Case Else
KindOfGirl = “Never Mind”
End Select
MsgBox KindOfGirl
End Sub
Run your code to test ad check. Click inside your textbox and enter number “1″. Then click your button to see what happens. Now enter the number “2″ and click your button. next, try the word “3″ or any character and see what happens. Notice that if you put “1″ or “2″ the messagebox will pop up and show what are the designated values that we assign to them.










