VB calc code need help on last portions
jmoney3457
Maine
here is my code:
Public Class Form1
Dim first As Double
Dim second As Double
Dim sign As String
Private Sub btnzero_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnzero.Click
txtdisplay.Text = btnzero.Text
'this allows for 0 to enter textbox when clicked
End Sub
Private Sub btnone_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnone.Click
txtdisplay.Text = btnone.Text
'this allows for 1 to enter textbox when clicked
End Sub
Private Sub btntwo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btntwo.Click
txtdisplay.Text = btntwo.Text
'this allows for 2 to enter textbox when clicked
End Sub
Private Sub btnthree_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnthree.Click
txtdisplay.Text = btnthree.Text
'this allows for 3 to enter textbox when clicked
End Sub
Private Sub btnfour_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnfour.Click
txtdisplay.Text = btnfour.Text
'this allows for 4 to enter textbox when clicked
End Sub
Private Sub btnfive_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnfive.Click
txtdisplay.Text = btnfive.Text
'this allows for 5 to enter textbox when clicked
End Sub
Private Sub btnsix_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsix.Click
txtdisplay.Text = btnsix.Text
'this allows for 6 to enter textbox when clicked
End Sub
Private Sub btnseven_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnseven.Click
txtdisplay.Text = btnseven.Text
'this allows for 7 to enter textbox when clicked
End Sub
Private Sub btneight_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btneight.Click
txtdisplay.Text = btneight.Text
'this allows for 8 to enter textbox when clicked
End Sub
Private Sub btnnine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnine.Click
txtdisplay.Text = btnnine.Text
'this allows for 9 to enter textbox when clicked
End Sub
Private Sub cmdclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdclear.Click
txtdisplay.Text = ""
End Sub
End Class
so far i've gotten it so when you press the digits 0-9 they will display in the textbox (txtdisplay) but now how do i get the operators (commands) to function and get the = command to display the answer in the textbox? also i need some if..else statements where would i put those in the code/how would i use them?
Public Class Form1
Dim first As Double
Dim second As Double
Dim sign As String
Private Sub btnzero_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnzero.Click
txtdisplay.Text = btnzero.Text
'this allows for 0 to enter textbox when clicked
End Sub
Private Sub btnone_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnone.Click
txtdisplay.Text = btnone.Text
'this allows for 1 to enter textbox when clicked
End Sub
Private Sub btntwo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btntwo.Click
txtdisplay.Text = btntwo.Text
'this allows for 2 to enter textbox when clicked
End Sub
Private Sub btnthree_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnthree.Click
txtdisplay.Text = btnthree.Text
'this allows for 3 to enter textbox when clicked
End Sub
Private Sub btnfour_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnfour.Click
txtdisplay.Text = btnfour.Text
'this allows for 4 to enter textbox when clicked
End Sub
Private Sub btnfive_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnfive.Click
txtdisplay.Text = btnfive.Text
'this allows for 5 to enter textbox when clicked
End Sub
Private Sub btnsix_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsix.Click
txtdisplay.Text = btnsix.Text
'this allows for 6 to enter textbox when clicked
End Sub
Private Sub btnseven_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnseven.Click
txtdisplay.Text = btnseven.Text
'this allows for 7 to enter textbox when clicked
End Sub
Private Sub btneight_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btneight.Click
txtdisplay.Text = btneight.Text
'this allows for 8 to enter textbox when clicked
End Sub
Private Sub btnnine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnine.Click
txtdisplay.Text = btnnine.Text
'this allows for 9 to enter textbox when clicked
End Sub
Private Sub cmdclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdclear.Click
txtdisplay.Text = ""
End Sub
End Class
so far i've gotten it so when you press the digits 0-9 they will display in the textbox (txtdisplay) but now how do i get the operators (commands) to function and get the = command to display the answer in the textbox? also i need some if..else statements where would i put those in the code/how would i use them?
0
Comments
Take anything that you may need from it. If you have questions go ahead and ask.