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.

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.

just use cache to perform this type of operation...
It will b fine.

commented: Nonsense! -2

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.