Thursday, March 19, 2020

Create simple Calculator in VB6.0 program


Create simple Calculator

Set  5 Label , 2 textbox , 4 command button








Source Code:-

Private Sub Command1_Click()
Label5.Caption = Val(Text1.Text) + Val(Text2.Text)
End Sub

Private Sub Command2_Click()
Label5.Caption = Val(Text1.Text) - Val(Text2.Text)
End Sub

Private Sub Command3_Click()
Label5.Caption = Val(Text1.Text) * Val(Text2.Text)
End Sub

Private Sub Command4_Click()
Label5.Caption = Val(Text1.Text) / Val(Text2.Text)
End Sub


Private Sub Form_Load()
Label1.Caption = "Calculator"
Label1.FontSize = 40
Label1.Font = "Times New Roman"
Label2.Caption = "First number"
Label2.FontSize = 20
Label2.Font = "Times New Roman"
Label3.Caption = "Second number"
Label3.FontSize = 20
Label3.Font = "Times New Roman"
Label4.Caption = "Result"
Label4.FontSize = 20
Label4.Font = "Times New Roman"
Label5.Caption = ""
Label5.FontSize = 20
Label5.Font = "Times New Roman"
Text1.Text = " "
Text1.FontSize = 20
Text1.Font = "Times New Roman"
Text2.Text = " "
Text2.FontSize = 20
Text2.Font = "Times New Roman"
Command1.Caption = "+"
Command1.Font = "Times New Roman"
Command1.FontSize = 30
Command2.Caption = "-"
Command2.Font = "Times New Roman"
Command2.FontSize = 30
Command3.Caption = "*"
Command3.Font = "Times New Roman"
Command3.FontSize = 30
Command4.Caption = "/"
Command4.Font = "Times New Roman"
Command4.FontSize = 30

End Sub


No comments:

Post a Comment