I have written a simple program that calculates a running $ total. This
program uses a checkbox to acknowledge that that version of the ticket
is desired and it checks the Qty box to see how many tickets are
desired. Based upon the checkbox being checked and the number of tickets
desired directly affects the running grand total (of course!). OK I
have set where if ticketsDesiredT otal>0 then checkbox.checke d = true.
The only problem I have is that if the user deletes the number of
tickets and the user does not enter a number and “ ” is in the tickets
desired box the program crashes. It crashes because it is taking the
value of TicketsDesiredT otal and multiplying it by the per ticket cost.
And the debugger says it can’t convert “” to use it in the equation.
How can I make this thing work??? Here is the code and the function it
calls:
Function processor()
Dim decTtl As Decimal = 0.0
Dim strOil As String = txtQtyOil.Text
If cbOil.Checked = True Then
lblOilTtl.Text = (txtQtyOil.Text * 150.0)
decTtl += lblOilTtl.Text
End If
If cbAllies.Checke d = True Then
lblAlliesTtl.Te xt = (txtQtyAllies.T ext * 50.0)
decTtl += lblAlliesTtl.Te xt
End If
If cbWardaddy.Chec ked = True Then
lblWarTtl.Text = 0.0
decTtl += lblWarTtl.Text
End If
lblSubTotal.Tex t = String.Format(" {0:C}", decTtl)
Dim decTxTtl = CDec(decTtl * 0.07)
lblTaxTtl.Text = String.Format(" {0:C}", decTxTtl)
lblGrandTtl.Tex t = String.Format(" {0:C}", (decTxTtl + decTtl))
End Function
Private Sub cbOil_CheckedCh anged(ByVal sender As System.Object, ByVal
e As System.EventArg s) Handles cbOil.CheckedCh anged
processor()
End Sub
Private Sub cbAllies_Checke dChanged(ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles cbAllies.Checke dChanged
processor()
End Sub
Private Sub cbWardaddy_Chec kedChanged(ByVa l sender As System.Object,
ByVal e As System.EventArg s) Handles cbWardaddy.Chec kedChanged
processor()
End Sub
Mike_Mac
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!