Multiple checkboxes that add values and remove value when selected/deselected

In my last post i asked about making multiple buttons add a value into a textfield, and i got that working. but now i want to try and do something similar but with checkboxes , i essentially got it working but when i have multiple checkboxes the values mess up, and it either keeps adding everytime i click the checkbox or it keeps subtracting the value, its very strange:
my current code is

Dim myButtonValue As Integer = 1 if CheckBox1.value = true then Sum = Sum + myButtonValue tfield_value.Text = "$" + Str(sum) else Sum = Sum - myButtonValue tfield_value.Text = "$" + Str(sum) end if

  • i have a property in the window that is called sum (integer)
    the problem occurs when i have 2+ checkboxes and i want them to work parallel without effecting each other.

thank you

Try me instead of CheckBox1.

Even if you click on CheckBox2 you only use the state of CheckBox1 in your code.

Init post has been del. What’s going wrong on there? :wink: