FalconFlyer
04-19-2013, 04:54 PM
I appreciate anyone's help in advance. I am working on a survey form in Word 2007. I need to have the user check a checkbox (each checkbox is given a value of 5, 4, 3, 2, or 1) and the sum total of these checkboxes total in a textbox.
For Example, I checked one box (checkbox1 = 5) and one box for (checkbox2 = 4). I want the Textbox to read 9 (Adding the 2 values). It will currently display "54". I may have 4 or 5 checkboxes for each textbox (which I will need it to add all those boxes too).
My Code:
Private Sub CheckBox1_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles CheckBox1.CheckedChanged, CheckBox2.CheckedChanged
Dim textboxtext As String = String.Empty
If CheckBox1.Checked Then textboxtext += "5"
If CheckBox2.Checked Then textboxtext += "4"
TextBox1.Text = textboxtext
End Sub
Thank you.
For Example, I checked one box (checkbox1 = 5) and one box for (checkbox2 = 4). I want the Textbox to read 9 (Adding the 2 values). It will currently display "54". I may have 4 or 5 checkboxes for each textbox (which I will need it to add all those boxes too).
My Code:
Private Sub CheckBox1_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles CheckBox1.CheckedChanged, CheckBox2.CheckedChanged
Dim textboxtext As String = String.Empty
If CheckBox1.Checked Then textboxtext += "5"
If CheckBox2.Checked Then textboxtext += "4"
TextBox1.Text = textboxtext
End Sub
Thank you.