Hi

I'm currently using data binding, combo boxes, grids...
I need to filter the data in a DataGridview depending on a value selected in a combo box. The combo is bound to a table, displaying data from a particular column, while the datagrid needs to "query" a second table "...WHERE condition = <combo value>".
If I add a parameter in the query a text box appears on my form. Is there a way to pass the value returned by the combo as a parameter for the datagrid query ?

Or perhaps another way to work with data without recordsets?

Never mind, i got it done.
I set a parameter in the query. VB automatically adds a toolstrip with a box for the @param1. I used a text box for @param1

Private Sub FillBy_textToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FillBy_textToolStripButton.Click
        Try            Me.Tbl_ERP_PRODUCTION_ORDERSTableAdapter.FillBy_text(Me.SITEQDataSet.tbl_ERP_PRODUCTION_ORDERS, TextToolStripTextBox.Text)
        Catch ex As System.Exception
            System.Windows.Forms.MessageBox.Show(ex.Message)
        End Try

    End Sub

Now I set the same for the text box:

Private Sub [B]txtOrder_TextChanged[/B](ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtOrder.TextChanged
        If txtOrder.TextLength < 4 Then Exit Sub
        Try
            Me.Tbl_ERP_PRODUCTION_ORDERSTableAdapter.FillBy_text(Me.SITEQDataSet.tbl_ERP_PRODUCTION_ORDERS, [b]txtOrder.Text[/b])
        Catch ex As System.Exception
            System.Windows.Forms.MessageBox.Show(ex.Message)
        End Try
    End Sub

that len check is for a live filter :)

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.