943,680 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 659
  • VB.NET RSS
Dec 3rd, 2008
0

My Calculator

Expand Post »
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:
VB.NET Syntax (Toggle Plain Text)
  1. 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
Last edited by Gwen203; Dec 3rd, 2008 at 7:24 pm. Reason: Edit
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Gwen203 is offline Offline
1 posts
since Dec 2008
Dec 6th, 2008
0

Re: My Calculator

Hi,

Not bad for a start but I have attached a full calc. code as a gift.
Attached Files
File Type: zip Forms.zip (29.0 KB, 24 views)
Reputation Points: 13
Solved Threads: 29
Junior Poster
kb.net is offline Offline
169 posts
since Aug 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: ORACLE
Next Thread in VB.NET Forum Timeline: Help with Advancing to Next Record, read line continued iteration problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC