|
-
Sep 18th, 2008, 01:21 PM
#1
Thread Starter
New Member
[RESOLVED] Beginner requesting help!
Hi, I'm new to visual basic and I've attempted to make a very simple calculator but I have no idea why it's not working. Of course I've done something stupid but I just can't find it.
The layout of the program is 3 text boxes:
FirstNumber
Operation
SecondNumber
1 Button:
Answer
1 Label:
Answer
The idea is to type in the first number, the operation (*/+-) and the second number, clicking the answer button. Then the label should hold the answer. This is my code:
Dim answerr, operation As String
Dim Firstnumber, Secondnumber As Double
Private Sub cmdAnswer_Click()
Firstnumber = Val(txtFirstnumber.Text)
Secondnumber = Val(txtSecondnumber.Text)
operation = txtOperation.Text
answerr = firstnumber operation secondnumber
Answerbox.Caption = answerr
End Sub
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|