VB.NET Calculator

Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Sep 2007
Posts: 2
Reputation: Bands is an unknown quantity at this point 
Solved Threads: 0
Bands Bands is offline Offline
Newbie Poster

VB.NET Calculator

 
0
  #1
Oct 19th, 2007
Hi, i'm trying to create a vb.net calcualtor similar to that of windows but with more functions, the problem is that i can't think of how i can use a single text box to get the two input numbers. i've tried using .visible but still does not work.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 37
Reputation: Chris147 is an unknown quantity at this point 
Solved Threads: 2
Chris147 Chris147 is offline Offline
Light Poster

Re: VB.NET Calculator

 
0
  #2
Oct 19th, 2007
Hi,

I did something like this myself. Use two variables (ie: Dim dblVal1 As Double, dblVal2 As Double).

Pass the 1st test entry to dblVal1, clear the text box (when the user presses a function key such as '+'), then pass the 2nd text box entry to dblVal2.

HTH, Chris.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 82
Reputation: preetham.saroja is an unknown quantity at this point 
Solved Threads: 1
preetham.saroja's Avatar
preetham.saroja preetham.saroja is offline Offline
Junior Poster in Training

Re: VB.NET Calculator

 
-1
  #3
Oct 19th, 2007
just use cache to perform this type of operation...
It will b fine.
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 66
Reputation: c0deFr3aK is an unknown quantity at this point 
Solved Threads: 10
c0deFr3aK's Avatar
c0deFr3aK c0deFr3aK is offline Offline
Junior Poster in Training

Re: VB.NET Calculator

 
0
  #4
Mar 7th, 2009
Adding to Numbers using your Numeric keypad VB.NET 2003
Just drag 1 label to your form
label1.backcolor = color.black
label1.forecolor = color.green
make some adjustments to your font as you want

Declare your variables

in your form use the KeyUp event
and place the code below
  1. Private f as String 'your first number
  2. Private s as String 'your second number
  3. private n as String
  4. private o as String 'this will be your operators variable
  5. Private sum as Double
  6.  
  7. Private Sub MainForm_KeyUp(Byval sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp
  8.  
  9. Select case e.KeyCode
  10. Case keys.Numpad0, keys.NumPad1 '(provide all the keycodes)
  11. f = e.KeyCode.ToString 'this will display what key your pressed
  12. f = f.Substring(6, 1) 'we will extract the last string of the keycode string
  13. n = n & f 'we will pass our first number to our variable n
  14. me.label1.Text = n 'we will display whats on variable n
  15.  
  16. Case keys.Decimal 'hmmm we will make some flavoring here
  17. n = n & "."
  18. f = ""
  19. n = n & f
  20. Case keys.Add
  21. o = "+" 'assign a plus sign to operators variable
  22. s = n 'we will pass our first number to the second number
  23. sum= Val(s) + Val(r) '
  24. me.label1.Text = FormatNumber(sum, 2, TriState.True, TriState.True, TriState.True)
  25. n = ""
  26. r = sum
  27. Case keys.Subtract
  28. 'do your part, explore, and discover something extraordinary
  29. 'happy coding
  30. End Select

so if i hopes there's nothing missing on the codes
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC