Try one of approaches. Add this before End Sub:
If Total_String = "" Then
MsgBox "Nothing selected"
End If
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
]1
when I choose the service and then I click submit the total of services will be appeared in the total text box. the problem is I want to make a warning message appear when I didn't choose any services and then click submit.
this is my if statement for the service:
Private Sub submit_Button_Click(sender As Object, e As EventArgs) Handles submit_Button.Click
'declare totaldecimal as decimal
Dim TotalDecimal As Decimal
Total_String = ""
'give total decimal a zero value to make sure when the calculation is started total decimal is zero
TotalDecimal = 0
' give If function if check box been tick
If service_CheckBox.Checked Then
'pass the value in service decimal to total decimal
TotalDecimal += SERVICE_Decimal
'change service decimal to string
Total_String += SERVICE_Decimal.ToString("C")
End If
If tune_up_CheckBox.Checked Then
'pass the value in tuneuo decimal to total decimal
TotalDecimal += TUNE_UP_Decimal
Total_String += TUNE_UP_Decimal.ToString("C")
End If
If transmission_service_CheckBox.Checked Then
'pass the value in transmission decimal to total decimal
TotalDecimal += TRANSMISSION_SERVICE_Decimal
Total_String += TRANSMISSION_SERVICE_Decimal.ToString("C")
End If
If wheele_alignment_CheckBox.Checked Then
'pass the value in wheel alignment decimal to total decimal
TotalDecimal += WHEEL_ALIGNMENT_Decimal
Total_String += WHEEL_ALIGNMENT_Decimal.ToString("C")
End If
If wheel_balance_CheckBox.Checked Then
'pass the value in wheel balance decimal to total decimal
TotalDecimal += WHEEL_BALANCE_Decimal
Total_String += WHEEL_BALANCE_Decimal.ToString("C")
End If
If discount_RadioButton.Checked Then
'calculate total decimal if discount radiobutton have been checked
TotalDecimal *= 0.1
End If
'display total decimal at total label
totalLabel.Text = TotalDecimal.ToString("C")
End Sub
Try one of approaches. Add this before End Sub:
If Total_String = "" Then
MsgBox "Nothing selected"
End If