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?

See if the following will help

 Dim lstTextboxes As New List(Of TextBox)
    Private Sub LoadTextBoxList()
        lstTextboxes.Add(txtCustomername)
        lstTextboxes.Add(txtPartcode)
        lstTextboxes.Add(txtinvo)

    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


'CALL SQL METHOD FROM SELECT CASE

        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

        Stop

    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.