Simple Calculator Developed In the Visual Basic Language 6.0

in english •  7 years ago 

Hello friends of Steemit... Today I bring you my first project that was carried out in my early career a simple calculator developed in the programming language Visual Basic 6.0.

Visual Basic 6.0 is a programming language developed by Microsoft for beginning and advanced developers can learn and use easily. Although Microsoft no longer offers support, thousands of applications still work on the basis and there are many more in development.

First Step

To begin we must open Visual Basic 6.0 and create a new Standard EXE project. The Standard EXE projects offer a series of commands and tools to develop so many simple programs.

Second Passage

To the Open Standard EXE we will find in the center of the screen a box with many points. Is your form. A form is the place in which you will add the various elements (buttons, images, text box) for your program.

On the left side of the screen is the toolbox. The toolbox contains a number of predefined items for any program. You can drag and drop these items to your form.

At the bottom right of the screen is the design of the form. This determines the place where you will show your program on the screen once the project is completed and will be run.

On the right side, it is the Properties box, which determines the properties of any selected item in the form. With it, you can change the various properties.

In the top right, is the Project browser. Displays the different designs and forms included in a project.

If you can't find some of these tables, you can add them by clicking the button "View" from the menu bar.

The third step

Would be the development of the text box, which we must locate in the toolbox as well as that of the command buttons; the image will leave the description are each buttons.

Fourth step

As we can see in the picture we have already changed the names to the boats of command and the text box is left blank the field that we can locate in the properties box.

Fifth step

Would be the programming of each command button gives you double click on each button command to schedule, in the following images we can observe each command button with your code. Thou wilt not let them apart and the codes of each command button.

Dim num1 As Integer
Dim num2 As Integer
Dim op As String
Private Sub Button_0_Click()
Text1.Text = Text1.Text & 0
End Sub
Private Sub Button_1_Click()
Text1.Text = Text1.Text & 1
End Sub
Private Sub Button_2_Click()
Text1.Text = Text1.Text & 2
End Sub
Private Sub Button_3_Click()
Text1.Text = Text1.Text & 3
End Sub
Private Sub Button_4_Click()
Text1.Text = Text1.Text & 4
End Sub
Private Sub Button_5_Click()
Text1.Text = Text1.Text & 5
End Sub
Private Sub Button_6_Click()
Text1.Text = Text1.Text & 6
End Sub
Private Sub Button_7_Click()
Text1.Text = Text1.Text & 7
End Sub

Private Sub Button_8_Click()
Text1.Text = Text1.Text & 8
End Sub
Private Sub Button_9_Click()
Text1.Text = Text1.Text & 9
End Sub
Private Sub Button_C_Click()
Text1.Text = ""
Text1.SetFocus
End Sub
Private Sub Button_Div_Click()
num1 = Text1.Text
Text1.Text = ""
op = "/"
Text1.SetFocus
End Sub
Private Sub Button_Igual_Click()
If (num1 = 0) Then
MsgBox ("No se realizo una operacion")
Else
num2 = Text1.Text
If op = "+" Then
Text1.Text = num1 + num2
End If
If op = "-" Then
Text1.Text = num1 - num2
End If
If op = "/" Then
Text1.Text = num1 / num2
End If
If op = "*" Then
Text1.Text = num1 * num2
End If
End If
End Sub

Private Sub Button_Mult_Click()
num1 = Text1.Text
Text1.Text = ""
op = "*"
Text1.SetFocus
End Sub
Private Sub Button_Punto_Click()
Text1.Text = Text1.Text & "."
End Sub
Private Sub Button_Resta_Click()
num1 = Text1.Text
Text1.Text = ""
op = "-"
Text1.SetFocus
End Sub
Private Sub Button_Suma_Click()
num1 = Text1.Text
Text1.Text = ""
op = "+"
Text1.SetFocus
End Sub

Then I will show you in a video the testing phase of the simple calculator.

I hope you like my post and vote for the.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Congratulations @nelsonenrique88! You received a personal award!

1 Year on Steemit

Click here to view your Board

Do not miss the last post from @steemitboard:

Christmas Challenge - Send a gift to to your friends

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @nelsonenrique88! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!