guyz help me. I want to filter the data that's being displayed to my datagrid once I click the combobox and select a specific value,the selected value will be the item to filter the data that I needed to be displayed in the datagrid.. I'm using a datatable,a combobox and a datagrid..here's my code
------------------------------------------------------------------------
Private Sub cboView_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboView.Click
dt = New DataTable
sda = New SqlDataAdapter("SELECT DISTINCT KPIPOSTCODE FROM KKPIGROUP", sqlcon)
sda.Fill(dt)
If dt.Rows.Count <> 0 Then
cboView.DataSource = dt
cboView.DisplayMember = dt.Columns(0).ColumnName
Call ref()
Else
End If
End Sub
'''here is function ref
------------------------------------------------------------------------------------
Public Sub ref()
dt = New DataTable
sda = New SqlDataAdapter("SELECT * FROM KKPIGROUP where KPIPOSTCODE = '" & cboView.text & "' ", sqlcon)
sda.Fill(dt)
If dt.Rows.Count = 0 Then
Else
dg.DataSource = dt
dg.Enabled = True
End If
End Sub
I hope you help me..