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.
Chris147
Junior Poster in Training
58 posts since Jun 2007
Reputation Points: 10
Solved Threads: 4
just use cache to perform this type of operation...
It will b fine.
preetham.saroja
Junior Poster in Training
82 posts since Jun 2007
Reputation Points: 5
Solved Threads: 1
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
Private f as String 'your first number
Private s as String 'your second number
private n as String
private o as String 'this will be your operators variable
Private sum as Double
Private Sub MainForm_KeyUp(Byval sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp
Select case e.KeyCode
Case keys.Numpad0, keys.NumPad1 '(provide all the keycodes)
f = e.KeyCode.ToString 'this will display what key your pressed
f = f.Substring(6, 1) 'we will extract the last string of the keycode string
n = n & f 'we will pass our first number to our variable n
me.label1.Text = n 'we will display whats on variable n
Case keys.Decimal 'hmmm we will make some flavoring here
n = n & "."
f = ""
n = n & f
Case keys.Add
o = "+" 'assign a plus sign to operators variable
s = n 'we will pass our first number to the second number
sum= Val(s) + Val(r) '
me.label1.Text = FormatNumber(sum, 2, TriState.True, TriState.True, TriState.True)
n = ""
r = sum
Case keys.Subtract
'do your part, explore, and discover something extraordinary
'happy coding
End Select
so if i hopes there's nothing missing on the codes
c0deFr3aK
Junior Poster in Training
71 posts since Mar 2009
Reputation Points: 11
Solved Threads: 10