I have data already populated in a datagrid
I have three textbox txtCustomername, txtPartcode, txtinvo

I want the user to be able to input text into the txtcustomername text box which will result in the datagrid only showing the rows that relate to that customer. Then I want the user to be able to input a partcode into the txtPartcode which will result in that data being reduced even more.

now i can write diffrent SQL select codes but it gets complicated testing which textbox are empty theirfor which select query to use.

does anyone have any ideas How i can accomplish this?

Attachments Picture1.jpg 47.79 KB

See if the following will help

 Dim lstTextboxes As New List(Of TextBox)
    Private Sub LoadTextBoxList()

    End Sub

    Private Sub btnTEST_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTEST.Click

        Dim query = From tb In lstTextboxes _
                    Where tb.Text = "" _
                    Select tb.Name


        Select Case query.First
            Case txtCustomername.Name
                MsgBox(txtCustomername.Name & " I'm Empty")
            Case txtinvo.Name
                MsgBox(txtinvo.Name & " I'm Empty")
            Case txtPartcode.Name
                MsgBox(txtPartcode.Name & " I'm Empty")

        End Select


    End Sub
This article has been dead for over six months. Start a new discussion instead.