Envy
New Member
Posts: 219
|
Post by Envy on May 19, 2004 21:17:27 GMT -5
Well I was trying to make a calculator with buttons but I can't figure out how to set one variable the number you clicked on and then when you click another it will set another variable the number you clicked. If I could get this then I would use on the divide button for example.. Text1.text= "var1 / var2"
Any other ideas on making a calculator with buttons? I am new to VB so be easy on me lol
|
|
Tewl
xTeam
C# & VB Developer
Posts: 495
|
Post by Tewl on May 19, 2004 22:22:49 GMT -5
you do not do call variables or do arithmetic inside quotes.
Text1.Text = var1 / var2
|
|
SudsyUncle®
New Member
Just because I'm paranoid, DOES NOT mean that noone is out to get me!
Posts: 58
|
Post by SudsyUncle® on May 19, 2004 22:23:21 GMT -5
now mind you this is off the top of my head but a push in the right direction for a beginner Dim var1 As Variant Dim var2 As Variant Dim trun As Integer
Private Sub Form_Load() trun = 1 End Sub
Private Sub Command1_Click() into 1 End Sub Private Sub Command2_Click() into 2 End Sub Private Sub Command3_Click() into 3 End Sub Private Sub Command4_Click() into 4 End Sub Private Sub Command5_Click() into 5 End Sub Private Sub Command6_Click() into 6 End Sub Private Sub Command7_Click() into 7 End Sub Private Sub Command8_Click() into 8 End Sub Private Sub Command9_Click() into 9 End Sub Private Sub Command0_Click() into 0 End Sub
Private Sub Command10_Click() Text1 = Val(var1) + Val(var2) trun = 1 End Sub
Private Sub Command30_Click() trun = 2 End Sub
Sub into(summ As Integer) If trun = 1 Then var1 = var1 & summ Text1 = var1 ElseIf trun = 2 Then var2 = var2 & summ Text1 = var2 End If End Sub
command1 and command2 would be yer 1 and 2 and so on command 30 would be for yer + command10 would be your = then just add for the math part and such edit- lol I just HAD to add a sub call
|
|