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.

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.