0% found this document useful (0 votes)
37 views2 pages

Visual Basic Training

The document contains code examples for Visual Basic training. Code 1 defines event handler subroutines for a text box, label, and button that display messages evaluating whether the text in the text box matches "java". Code 2 defines event handler subroutines for a combo box and button that display different messages evaluating the selected text in the combo box for matches to "C#", "Fortran", and "Java", or a default message. It also sets the initial selected index of the combo box to 1 on form load.

Uploaded by

Zubair Khan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views2 pages

Visual Basic Training

The document contains code examples for Visual Basic training. Code 1 defines event handler subroutines for a text box, label, and button that display messages evaluating whether the text in the text box matches "java". Code 2 defines event handler subroutines for a combo box and button that display different messages evaluating the selected text in the combo box for matches to "C#", "Fortran", and "Java", or a default message. It also sets the initial selected index of the combo box to 1 on form load.

Uploaded by

Zubair Khan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Visual basic training Code 1 :

Public Class Form1 Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim language As String language = TextBox2.Text If language = "java" Then MsgBox("We have a winner ") Else MsgBox(language & " is not a bad language") End If End Sub End Class

Code 2:
Public Class Form1 Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim language = ComboBox1.Text If language = "C#" Then MsgBox("Good Choice but its pure object oriented") ElseIf language = "Fortron" Then MsgBox("Old is gold") ElseIf language = "Java" Then MsgBox("Wow great choice") Else MsgBox(language & " Fine your answer could be better if you want ") End If End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ComboBox1.SelectedIndex = 1 End Sub End Class

Read till page 21 ;

You might also like