VB second lesson and work program calculator
The second lesson to explain BB Visual Basic and the work of the first program you
First, save the codes come iterating in making programs do not rush
First, the work program of the calculator Seshrj codes, God willing,
Open Visual press standaed EXE
Free four command (command button) and is their name from the caption in properties
Free three textbox and clear what their characteristic text
And ranks as follows
Now we got to the stage of writing code
Press the Collect button twice and type between the two lines
text3.text = val (text1.text) val (text2.text)
The code is as follows
() Private Sub Command1_Click
Text3.Text = Val (Text1.Text) Val (Text2.Text)
End Sub
Explain code
The code is very simple, a raise in text1 text2 to show output in text3
Note After each tool insert characteristic example, after text1 put points. Then text
Press subtract twice and copy the same code with the change to - to become
Private Sub Command2_Click ()
Text3.Text = Val (Text1.Text) - Val (Text2.Text)
End Sub
Click on strike twice and copy the same code with change to * a multiplication sign in the Visual
To the code as follows
() Private Sub Command3_Click
Text3.Text = Val (Text1.Text) * Val (Text2.Text)
End Sub
Click on oath twice and copy the same code with change b / a sign divisible
To the code as follows
() Private Sub Command4_Click
Text3.Text = Val (Text1.Text) / Val (Text2.Text)
End Sub
To become the overall program code
() Private Sub Command1_Click
Text3.Text = Val (Text1.Text) Val (Text2.Text)
End Sub
Private Sub Command2_Click
Text3.Text = Val (Text1.Text) - Val (Text2.Text)
End Sub
Private Sub Command3_Click ()
Text3.Text = Val (Text1.Text) * Val (Text2.Text)
End Sub
Private Sub Command4_Click ()
Text3.Text = Val (Text1.Text) / Val (Text2.Text)
End Sub
Now to run the program press F5
Notes
If I wrote the code without val () program will collect figures literally, for example, 2 1 = 12
Please Give Us Your 1 Minute In Sharing This Post!
Related Posts:
visal basic
0 التعليقات:
إرسال تعليق