Confused

Microbyte

New member
Joined
May 10, 2009
Messages
1
Programming Experience
Beginner
Ok, I have only been playing around with vb.net for about 3 days now, and I absolutely love it. I seem to be stuck tho, I am writting a basic caculator, as a stepping stone, and I'm lost on how to get the equal button to corrilate well with my +,-,/,* buttons. I'm sure there is a much more logical way to write this program.

1-9 buttons are this format

TextBox1.Text = TextBox1.Text + "9"
--------------------------------------------

(+,-,*,/) buttons
-----------------

Private Sub AddictionButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Butt-on10.Click

w = w + Val(TextBox1.Text)
TextBox1.Clear()

Private Sub Subtractionbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
x = x - Val(TextBox1.Text)
TextBox1.Clear()

Private Sub MultiButton(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
y = y * Val(TextBox1.Text)
TextBox1.Clear()

Private Sub DivisionButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
z = z / Val(TextBox1.Text)
TextBox1.Clear(
-----------------------
Equal Button
-----------------------
Private Sub Totalbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles equal.Click

If w Then total = w + Val(TextBox1.Text)
If x Then total = x - Val(TextBox1.Text)
If y Then total = y * Val(TextBox1.Text)
If z Then total = z / Val(TextBox1.Text)
TextBox1.Text = total
---------------------------------------------
Global Variable
Dim w As Integer
Dim x As Integer
Dim y As Integer
Dim z As Integer
Dim total As String
------------------------------------------------

Any help will be much appreciated.
Thank You.
 
Back
Top