how to create pop up message when checked box didn't check

Faris z 21 Reputation points
2021-10-21T12:48:11.347+00:00

![142679-screenshot-2021-10-22-132503.png]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  
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,580 questions
{count} votes

Accepted answer
  1. Viorel 112.5K Reputation points
    2021-10-22T05:48:44.577+00:00

    Try one of approaches. Add this before End Sub:

    If Total_String = "" Then
       MsgBox "Nothing selected"
    End If
    

0 additional answers

Sort by: Most helpful