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.
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
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
'do your part, explore, and discover something extraordinary
so if i hopes there's nothing missing on the codes