The document contains code snippets for 4 different Visual Basic programs: 1) concatenating two strings to display a full name, 2) determining if a number is even or odd, 3) calculating the square of a number, and 4) changing the background color of a form by clicking different buttons. Each code example demonstrates handling a button click event and performing a simple task like mathematical operation, string manipulation, or property change.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
26 views2 pages
Concatenating Two Strings
The document contains code snippets for 4 different Visual Basic programs: 1) concatenating two strings to display a full name, 2) determining if a number is even or odd, 3) calculating the square of a number, and 4) changing the background color of a form by clicking different buttons. Each code example demonstrates handling a button click event and performing a simple task like mathematical operation, string manipulation, or property change.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 2
Concatenating two strings
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click Label3.Text = "My Full Name is" + TextBox1.Text + " " + TextBox2.Text End Sub
Write a program to find number is odd or even in Vb
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click Dim num As Integer num = TextBox1.Text If num Mod 2 = 0 Then Label2.Text = TextBox1.Text + " " + "is Even." Else Label2.Text = TextBox1.Text + " " + "is odd." End If End Sub
Write a program to find a square root program in Vb
Private Sub Command1_Click()
Dim Num as Interger Num = Val ( Text1.Text) Num = Num * Num Text2.Text = Format $ ( Num ) End Sub
Write a program for change a color background in Vb
Private Sub C1_Click()
Form1.Backcolor = VbRed End Sub
Private Sub C2_Click()
Form1.Backcolor = VbGreen End Sub Private Sub C3_Click() Form1.Backcolor = VbBlack End Sub