Thanks this should be a big help. 

--- In [EMAIL PROTECTED], "Tim Rupp" <[EMAIL PROTECTED]> wrote:
> Why do anything at all with number presses....let your text box 
hold the
> value as it is entered from the keystrokes using the 
TextBox.TextChanged
> method to gather your input number.  Perhaps you want to verify 
that the
> keystroke is numeric, decimal point, and perhaps A-E if your going 
to
> allow hex calculations...but that's your choice. When the operand 
key is
> hit (+,-,/,*) just take the value of your text display and assign 
that
> to a temporary value (Operand1 = Val(txtEnter.Text) ) 
>  
> At that point I'd highlight the text in the text box and reset the
> cursor to the first character so that the next keystroke entry will
> clear your text box. Then assign the second operand and perform the
> operation in the same manner when the equals key or successive
> calulation key is struck. At that point you would perform the
> calculation, assign the result to your result value, and display 
that
> value in your text box (once again highlighting the text and 
placing the
> cursor at the beginning of the field so that additional entries 
from the
> keyboard once again clear your display.
>  
> For even more fun, try the RPN calculator type!
>  
> Enjoy,
> tim
>  
> 
> -----Original Message-----
> From: sramey28 [mailto:[EMAIL PROTECTED] 
> Sent: Monday, August 30, 2004 4:57 PM
> To: [EMAIL PROTECTED]
> Subject: [vbhelp] trying to make calculator with vb.net
> 
> 
> Hi, I'm trying to learn vb.net for work. I only have books and 
> online class and online help to learn from. I'm trying to make a 
> simple calculator. here is some of my code. The btnNine_click is 
> just like procedures for the numbers 0-8. What I need help with is 
> the idea of the Display (txtEnter) showing the right numbers. 
Right 
> now I'm only working on addition of numbers. I'm not sure if the 
> addition function has to be a function or sub. Here are the steps 
to 
> my problem.
> 
> 1. any number is clicked. 
> 2. This number shows up in display
> 3. Click the (add +) button
> 4. previous number disappears, leaving display blank
> 5. Next Click another number.
> 6. That one appears in display
> 7. Now click (equal =) button
> 8. The answer displayed is First number plus itself.
> 
> I think my problem lies in the Addition function line:
> answer = Double.Parse(number) + Double.Parse(lblNum.Text)
> both number and lblNum.text point to the same number. 
> 
> Main question 
> How do I get the second number entered recongized and added to the 
> first number entered. This easy if there are two textboxes, but 
with 
> one I don't know how to do this. 
> 
>     Private Sub btnNine_Click( _
>     ByVal sender As System.Object, _
>     ByVal e As System.EventArgs) Handles btnNine.Click
>         number = number + "9"
>         txtEnter.Text = number
>     End Sub
> 
>     Private Sub btnDecimal_Click( _
>     ByVal sender As System.Object, _
>     ByVal e As System.EventArgs) Handles btnDecimal.Click
>         number = number + "."
>         txtEnter.Text = number
>     End Sub
> 
>     Public Function Addition() As Integer
>         answer = Double.Parse(number) + Double.Parse(lblNum.Text)
>         lblNum.Text = String.Empty    'cleared for 2nd number 
enter 
>         number = ""    'tried clear number variable for second 
number
>     End Function
> 
>     Private Sub btnAdd_Click( _
>     ByVal sender As System.Object, _
>     ByVal e As System.EventArgs) Handles btnAdd.Click
>         lblNum.Text = CStr(number)      'These two lines are more
>         txtEnter.Text = String.Empty    'of trying to clear the  
>         Addition()                      'number      
>     End Sub
> 
>     Private Sub btnEqual_Click( _
>     ByVal sender As Object, _
>     ByVal e As System.EventArgs) Handles btnEqual.Click
>         txtEnter.Text = CStr(answer)
>     End Sub
> Thanks sramey28
> 
> 
> 
> 
> 
> '// =======================================================
>     Rules : http://ReliableAnswers.com/List/Rules.asp
>     Home  : http://groups.yahoo.com/group/vbHelp/
>     =======================================================
>     Post  : [EMAIL PROTECTED]
>     Join  : [EMAIL PROTECTED]
>     Leave : [EMAIL PROTECTED]
> '// =======================================================
> 
> 
> 
> 
> Yahoo! Groups Sponsor 
> 
> ADVERTISEMENT
>  
> 
<http://us.ard.yahoo.com/SIG=129cblskp/M=298184.5285298.6392945.30011
76/
> 
D=groups/S=1705115364:HM/EXP=1093987023/A=2319501/R=0/SIG=11tq0u909/*
htt
> p://www.netflix.com/Default?mqso=60185353&partid=5285298> click 
here    
>  
> <http://us.adserver.yahoo.com/l?
M=298184.5285298.6392945.3001176/D=group
> s/S=:HM/A=2319501/rand=680771713>     
> 
> 
>   _____  
> 
> Yahoo! Groups Links
> 
> 
> *     To visit your group on the web, go to:
> http://groups.yahoo.com/group/vbhelp/
>   
> 
> *     To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]> 
>   
> 
> *     Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/> . 
> 
> 
> 
> 
> [Non-text portions of this message have been removed]




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/k7folB/TM
--------------------------------------------------------------------~-> 


'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [EMAIL PROTECTED]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to