Can i put system datatable together with boolean?

CheeFaiy 1 Reputation point
2022-05-24T02:29:55.097+00:00

I have a problem which i have datatable for getHoliday and a boolean to check an error when user enter wrong input for example user dont select any value from combobox so it'll show you an error after you click the button submit. the datatable getHoliday is use for when user click any date on holiday it'll not execute when user click button submit. So now, i need a solution for when user click button submit it'll show an error message.
Below is the function for checking.

   Private Function ErrorFree() As Boolean

        If lblEmpNO.Text = "" Then
            DisplayMessage("error", "ERROR", "Please Select Employee No!")
            Return False
            Exit Function
        ElseIf lblemployeename.Text = "" Then
            DisplayMessage("error", "ERROR", "Please Select Employee No!")
            Return False
            Exit Function
        ElseIf lbldepartment.Text = "" Then
            DisplayMessage("error", "ERROR", "Please Select Employee No!")
            Return False
            Exit Function
        ElseIf cmbReason.SelectedIndex = -1 Then
            DisplayMessage("error", "ERROR", "Please Select The Reason!")
            Return False
            Exit Function
        ElseIf datepickerFrom.Text = "" Then
            DisplayMessage("error", "ERROR", "Please Select The Date!")
            Return False
            Exit Function
        ElseIf datepickerto.Text = "" Then
            DisplayMessage("error", "ERROR", "Please Select The Date!")
            Return False
            Exit Function
        ElseIf txtRemark.Text = "" Then
            DisplayMessage("error", "ERROR", "Remarks is empty!")
            Return False
            Exit Function

        End If
        Return True
    End Function
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,246 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,654 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,564 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Yijing Sun-MSFT 7,061 Reputation points
    2022-05-24T07:24:58.02+00:00

    Hi @CheeFaiy ,
    You said you use the combox and the submit button. However, I don's see any codes you post about these. Please post more reference codes.
    When you click the submit button, it will trigger the button click event. And then it will check the combobox 's value. Whether you have trigger the ErrorFree() method?

    Best regards,
    Yijing Sun


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.