I have made a form that loads at the begining of my program. Checks for accounts due on the day the program is run. It loads fine with my SELECT statement. Can someone help figur out how to close the form if the Select returns NULL.. Here is my form Load code..

Private Sub Accounts_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'AutoBillDS.Customer' table. You can move, or remove it, as needed.
        Me.CustomerTableAdapter.Fill(Me.AutoBillDS.Customer)
        LblToday.Text = FormatDateTime(Now, DateFormat.ShortDate)
        LblTime.Text = FormatDateTime(Now, DateFormat.LongTime)
        CustomerBindingSource.Filter = "Next_Billing Like'" & LblToday.Text & "%'"
    End Sub

Thanks for any help I can use.

Edited 5 Years Ago by Narue: Fixed code tags

Private Sub Accounts_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'AutoBillDS.Customer' table. You can move, or remove it, as needed.
        Me.CustomerTableAdapter.Fill(Me.AutoBillDS.Customer)

        'TODO: The next two lines load todays date and the current time
        LblToday.Text = FormatDateTime(Now, DateFormat.ShortDate)
        LblTime.Text = FormatDateTime(Now, DateFormat.LongTime)

        'TODO: This line of code filter the database looking for todays date to load the datagrid,
        'if return is NULL then the form will auto close.
        CustomerBindingSource.Filter = "Next_Billing Like'" & LblToday.Text & "%'"

        If DataGridView1.RowCount = 0 Then
            Me.Close()
        End If



    End Sub

Edited 5 Years Ago by Ezzaral: Fixed code tag.

This question has already been answered. Start a new discussion instead.