I have tried everything I could think of with no luck to speak of. What I am attempting to do is very simple. I would like to be able to put up a message box with an error and allow the user to enter data ( in the event that the user clicks on the calculate button without any data in the form. I am halfway there, but run into a strong wall in getting the code right. I welcome any and all helpful comments and or suggestions.
Code:Public Class LongDistanceCall Dim notANumber As Boolean Dim DAYRATE As Double = 0.07 Dim EVENRATE As Double = 0.12 Dim OFFPEAK As Double = 0.05 Dim MinutesUsed As Double Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click ' ********************* start of problem area ********************************** MinutesUsed = CDbl(txtMinutesUsed.Text) If (MinutesUsed) <= 0 Then MessageBox.Show("Can not less then 1 Minute", "ERROR DETECTED", MessageBoxButtons.OK, MessageBoxIcon.Error) txtMinutesUsed.Text = String.Empty End If ' ********************* end of problem area ********************************** If RadDayTime.Checked = True Then lblCharges.Text = FormatCurrency(MinutesUsed * DAYRATE) ElseIf RadEvening.Checked = True Then lblCharges.Text = FormatCurrency(MinutesUsed * EVENRATE) ElseIf RadOffPeak.Checked = True Then lblCharges.Text = FormatCurrency(MinutesUsed * OFFPEAK) Else MessageBox.Show("Pleae Select one of the offered plans", "Missing information", MessageBoxButtons.OK, MessageBoxIcon.Information) End If End Sub Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click lblCharges.Text = String.Empty RadDayTime.Checked = False RadEvening.Checked = False RadOffPeak.Checked = False txtMinutesUsed.Clear() End Sub Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click Me.Close() End End Sub




Reply With Quote
