Okey Let's start!
Posted by
Darki
Let's make a calculator. All you need is Visual Basic 6.0 . Open the program and select STANDARD .EXE . Add 3 Label's 3 Text Boxes and 4 Command Buttons. Like me.
Oke, the design is ready. Let's write a code now:
Dim fnum As Double
Dim snum As Double
Private Sub Command1_Click()
On Error GoTo a
fnum = Text1.Text
snum = Text2.Text
Text3.Text = fnum + snum
a:
End Sub
Private Sub Command2_Click()
On Error GoTo b
fnum = Text1.Text
snum = Text2.Text
Text3.Text = fnum - snum
b:
End Sub
Private Sub Command3_Click()
On Error GoTo c
fnum = Text1.Text
snum = Text2.Text
Text3.Text = fnum * snum
c:
End Sub
Private Sub Command4_Click()
On Error GoTo d
fnum = Text1.Text
snum = Text2.Text
Text3.Text = fnum / snum
d:
End Sub
Done! Test it now! Yeah it works :P
If u have any questions , suggestions , if u find bugs or anything else just comment :P
Note: First write numbers in Text1 & Text2 then click the mark (+ , - , * , /)
Subscribe to:
Post Comments (Atom)
Post a Comment