coca_lata coca_lata - 9 months ago 41 Question

sum a not enabled text box enabled as a zero

i'am using 9 textboxes in one form and i want the application to sum the numbers into another label in another form , the user not have to fill all of the 9 text boxes,so i used a 9 checkboxes to enable every textbox separately.
the problem is when i hit the button that suppose to make the sum equation without checking all of the 9 checkboxes and fill the 9 textboxes the application stops and shows an error.
i want to sum a textbox.enabled = false
as zero
and that's my button code:

Private Sub Button1_Click(Sender As Object, e As EventArgs) Handles Button1.Click
Dim intNum1 As Decimal
Dim intNum2 As Decimal
Dim intNum3 As Decimal
Dim intNum4 As Decimal
Dim intNum5 As Decimal
Dim intNum6 As Decimal
Dim intNum7 As Decimal
Dim intNum8 As Decimal
Dim intNum9 As Decimal
intNum1 = Decimal.Parse(TextBox1.Text)
intNum2 = Decimal.Parse(TextBox2.Text)
intNum3 = Decimal.Parse(TextBox3.Text)
intNum4 = Decimal.Parse(TextBox4.Text)
intNum5 = Decimal.Parse(TextBox5.Text)
intNum6 = Decimal.Parse(TextBox6.Text)
intNum7 = Decimal.Parse(TextBox7.Text)
intNum8 = Decimal.Parse(TextBox8.Text)
intNum9 = Decimal.Parse(TextBox9.Text)
Form5.Label1.Text = intNum1 + intNum2 + intNum3 + intNum4 + intNum5 + intNum6 + intNum7 + intNum8 + intNum9


You should use

intNum1 = Val(TextBox1.Text)

Instead of

intNum1 = Decimal.Parse(TextBox1.Text)