Good day to everyone.

Im just able to finish my banking system with QB SDK integration. I just want to ask help, idea or any other way to make a mathematical operation in a single textbox.Like you can perform to add two numbers in a single textbox and display the result on the same box like what quickbooks do in its textbox.

pls help.

Thank you & God bless us all.

Option Explicit

Private Sub Form_Load()
Dim I As Integer

For I = 1 To 10
  List1.AddItem CStr(Int(10 * Rnd) + 1)
Next I

End Sub

Private Sub Command1_Click()
Dim I As Integer, Tot As Integer
For I = 0 To List1.ListCount - 1
  Tot = Tot + Int(List1.List(I))
Next I
List1.AddItem "Total = " & Tot

End Sub

Good Luck

That's good but i changed a little .I used combo box and changed its STYLE to SimpleCombo .It will help you to show numbers added and if you like you can change the wrong numbers !!
And used this code

Dim a As Integer
Dim b As Integer
Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
    If a = 1 Then
     b = Combo1.Text
     Combo1.Clear
     Combo1.AddItem (b)
     b = 0
     a = 0
     Else
    Combo1.AddItem (Combo1.Text)
    End If
End If
End Sub
Private Sub Form_Load()
Dim i As Integer
 For i = 1 To 10
  Combo1.AddItem CStr(Int(10 * Rnd) + 1)
Next i
 End Sub
 Private Sub Command1_Click()
Dim i As Integer, Tot As Integer
For i = 0 To Combo1.ListCount - 1
  Tot = Tot + Int(Combo1.List(i))
Next i
Combo1.AddItem "Total = " & Tot
 a = 1
End Sub

Now you can add values using that combo by pressing return key and if you wish you can show the values by changing its height.
And If you like you can replace the existing item , i mean a checking ..
just add a text box and a command button and this code

Private Sub Command2_Click()
Dim c As Integer
c = Combo1.ListIndex
Combo1.RemoveItem (c)
Combo1.AddItem (Text1.Text)
End Sub

Good luck .......Just try

You can also try the following:

Add another 2 textboxes (Text2, Text3), set its visible property to False and its Text to "0"

If KeyAscii = 13 Then
    Text3.Text = Val(Text3.Text) + 1
    If Val(Text3.Text) > 2 Then
        Text1.Text = Val(Text2.Text)
        Text1.Locked = True
            Else
        Text2.Text = Val(Text2.Text) + Val(Text1.Text)
        Text1.Text = ""
        Text1.SetFocus
    End If
End If

You can also try the following:

Add another 2 textboxes (Text2, Text3), set its visible property to False and its Text to "0"

If KeyAscii = 13 Then
    Text3.Text = Val(Text3.Text) + 1
    If Val(Text3.Text) > 2 Then
        Text1.Text = Val(Text2.Text)
        Text1.Locked = True
            Else
        Text2.Text = Val(Text2.Text) + Val(Text1.Text)
        Text1.Text = ""
        Text1.SetFocus
    End If
End If

thank you for the responses and im sorry for late reply because of internet connection repair. But i still dont get the right solution.

I need to show the numbers and the operation on the combo list every time the user has input on the same combo.example(1 + 2 -3) i need to display like this way:
1
+ 2
- 3

the combo box should pop up like the above example.when i press enter it will show the result depending of what number the user has input. could that be possilbe.?pls help.

Thank you very much guys for giving me time.

Looks/sounds like you are trying to make a stack class (hint there are your keywords) Use your friends (yahoo, google, ask, answer, bing)

Good Luck

Looks/sounds like you are trying to make a stack class (hint there are your keywords) Use your friends (yahoo, google, ask, answer, bing)

Good Luck

thank you for a hint. i will be posting updates until this problem will solve. i will not stop until i get the right solution.thank you guys for your support.

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.