Hello There. I am a bit stuck here I need URGENT HELP!!
I have a combo box that I populated with "Publisher" column in form lord. I want to use the combo box to fliter the Datagrid. Here is my code. When I click Button to show the filtered results, nothing happens.VB Code:
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load OleDbDataAdapter1.Fill(MyDataset11) cbPublisher.DataSource = MyDataset11.Tables(0) cbPublisher.DisplayMember = "Publisher" cbPublisher.ValueMember = "Publisher" End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim pub As String pub = cbPublisher.Text Dim dtBooks As New DataTable Dim foundrows() As DataRow dtBooks = MyDataset11.Tables(0) Dim sqlString As String = "SELECT * FROM Book WHERE pub = " & "'" & pub & "'" & "" foundrows = dtBooks.Select("Publisher = 'sqlString'") End Sub




Reply With Quote