DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   My Calculator (http://www.daniweb.com/forums/thread160700.html)

Gwen203 Dec 3rd, 2008 7:21 pm
My Calculator
 
I made a Calculator with 3 Textboxes (the First 2 for the Variables the Third for the Result) and 4 buttons (+, -, *, /) and the code i used for the subtraction button was:
   TextBox3.Text = Val(TextBox1.Text) - Val(TextBox2.Text)

But Heres all my Code:

Quote:

Private Sub CloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseToolStripMenuItem.Click
'Closes Form
Me.Close()
End Sub

Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
'Shows Form2 or the About Form
Form2.Show()
End Sub

Private Sub HelpToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HelpToolStripMenuItem1.Click
'Shows Form3 or the Help Form
Form3.Show()
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Add Button
TextBox3.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'Subtract Button
TextBox3.Text = Val(TextBox1.Text) - Val(TextBox2.Text)
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
'Multiply Button
TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
'Divide Button
TextBox3.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
End Sub
End Class
And i used 02 + 04 and i got it to = 6


Its not the most Advanced Calculator but I was board one day

kb.net Dec 6th, 2008 7:51 pm
Re: My Calculator
 
1 Attachment(s)
Hi,

Not bad for a start but I have attached a full calc. code as a gift.


All times are GMT -4. The time now is 8:10 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC