Visual Basic Project
Display Message Box by Pressing Command Button:-
Source Code : Output :
Private Sub CommandButton1_Click()
MsgBox ("Welcome to Visual Basic")
End Sub
Password Programs:-
Source Code : Output :
Private Sub CommandButton1_Click()
If TextBox1.Text = (192) Then
MsgBox ("Password Accepted")
Else
MsgBox ("Wrong Password")
End If
End Sub
Joining Two String (Concatenation) :-
Source Code : Output :
Private Sub CommandButton1_Click()
TextBox3.Text = TextBox1.Text + " " + TextBox2.Text
End Sub
Multiplication of Number :-
Source Code : Output :
Private Sub CommandButton1_Click()
TextBox3.Text = Val(TextBox1.Text) *
Val(TextBox2.Text)
End Sub
Private Sub CommandButton2_Click()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub
Checking Leap Year :-
Source Code : Output :
Private Sub CommandButton1_Click()
Dim a As Integer
a = Val(TextBox1.Text)
If a Mod 4 = 0 Then
TextBox2.Text = "This is Leap Year"
Else
TextBox2.Text = "This is not Leap Year"
End If
End Sub
Private Sub CommandButton2_Click()
TextBox1.Text = ""
TextBox2.Text = ""
End Sub
Calculate Addition and Average:-
Source Code : Output :
Private Sub CommandButton1_Click()
TextBox4.Text = Val(TextBox1.Text) +
Val(TextBox2.Text) + Val(TextBox3.Text)
TextBox5.Text = Val(TextBox1.Text) +
Val(TextBox2.Text) + Val(TextBox3.Text) / 3
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Copy Text from one Text Box to Another Text Box :-
Source Code : Output :
Private Sub CommandButton1_Click()
TextBox2.Text = TextBox1.Text
End Sub
Private Sub CommandButton2_Click()
TextBox1.Text = ""
TextBox2.Text = ""
End Sub
Private Sub CommandButton3_Click()
Unload Me
End Sub