Simple Programs in VB
Program 1:
Private Sub Command1_Click()
Text1.Text = "Sathya"
Text2.Text = "24"
End Sub
Private Sub Form_Load()
Me.WindowState = 2
End Sub
Output:
Program 2:
Dim a, b As Integer
Private Sub Command1_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
Text3.Text = a + b
End Sub
Private Sub Command2_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
Text3.Text = a - b
End Sub
Private Sub Command3_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
Text3.Text = a * b
End Sub
Private Sub Command4_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
Text3.Text = a / b
End Sub
Private Sub Command5_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
Private Sub Command6_Click()
Unload Me
End Sub
Output:
Program
3:
Private Sub Command1_Click()
Text1.FontBold = True
End Sub
Private Sub Command2_Click()
Text1.FontItalic = True
End Sub
Private Sub Command3_Click()
Text1.FontUnderline = True
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Form_Load()
Me.WindowState = 2
End Sub
Output:
No comments:
Post a Comment