Saturday, August 31, 2019

HOW TO CREATE AN CALCULATOR USING VB PROGRAMMING.



Hi Friends Today i will show you how you can be Create an Calculator in VB(Visual Basic 6.0)


  • To Make An Calculator you need to insert Two Label Control's.
  • And another Control's need to insert is  Two Text box Control.
  • Four Command button is placed to the form.
  • As Shown in Picture Arrange it.
  • Also Placed Another Label for Output or Display of Calculation of Simple Calculator. 
  • In this Example I used default names of Control.  

Coding of Calculator

Private Sub Command1_Click(Index As Integer)
If Index = 0 Then
    Label3.Caption = Val(Text1.Text) + Val(Text2.Text)
ElseIf Index = 1 Then
    Label3.Caption = Val(Text1.Text) - Val(Text2.Text)
ElseIf Index = 2 Then
    Label3.Caption = Val(Text1.Text) * Val(Text2.Text)
Else
    Label3.Caption = Val(Text1.Text) / Val(Text2.Text)
End If
End Sub
Code Window of Calculator
  
Output View of Calculator
Design View of Calculator

No comments:

Post a Comment