I am trying to make a cash register windows form (that would look like the picture below) and I KNOW I am overthinking this but I am really new to vb and really am confused by it all. But it just needs to add and subtract the balance. I need help figuring out how to do the math here, like since the user will enter all values how do we anticipate what they will enter in the code?
Here is what I have so far though:
Public Class frmCashRegister
Dim Total As Decimal
Dim Subtract As Decimal
Dim Balance As Decimal
Private Sub btnAdd_Click(sender As System.Object, e As System.EventArgs) Handles btnAdd.Click
txtBalance.Text = FormatCurrency(Val(txtAmount.Text))
End Sub
Private Sub txtBalance_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtBalance.TextChanged
If (txtBalance.Text < 0) Then
MsgBox("Transaction resulted in negative balance, please try again!")
End If
End Sub
Private Sub txtAmount_KeyPress(sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtAmount.KeyPress
If Asc(e.KeyChar) <> 8 Then
If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then
e.Handled = True
End If
End If
End Sub
End Class

First of all you need to screen all of your inputs to make sure that the user cannot enter anything that would cause an error. In the case of a simple cash register you need to make sure the the numbers, minus add and possibly the enter key works. As far as your Math you need to keep a variable with your running total in this case Balance you will then update this variable when you add and subtract your values and update your balance TextBox with the Value. Here is an idea on how to do it.