Filtring a column with a DataGridView1 only ( withoutaccess or sql)
-
Hello everyone, In my application, I have DataGridView1. The DataGridView is not connected at Access or Sql (or others basses). I would like to create a filter from a Textbox3 for column1. My DataGridView1 is filling from Textbox1 & Textbox2 manually. Here my code:(it doesn't work) Sub filtre() Dim DataGridView1 As DataRowView DataGridView1.RowFilter = "Column1 ='Like'%" & TextBox3.Text End Sub Thank you very Much for your help. Have good day.
-
Hello everyone, In my application, I have DataGridView1. The DataGridView is not connected at Access or Sql (or others basses). I would like to create a filter from a Textbox3 for column1. My DataGridView1 is filling from Textbox1 & Textbox2 manually. Here my code:(it doesn't work) Sub filtre() Dim DataGridView1 As DataRowView DataGridView1.RowFilter = "Column1 ='Like'%" & TextBox3.Text End Sub Thank you very Much for your help. Have good day.
Member 13611972 wrote:
='Like'%
That doesn't look like a valid filter. Try:
DataGridView1.RowFilter = "Column1 Like '%" & TextBox3.Text & "%'"
The filter syntax is explained here: DataColumn.Expression Property (System.Data) | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Member 13611972 wrote:
='Like'%
That doesn't look like a valid filter. Try:
DataGridView1.RowFilter = "Column1 Like '%" & TextBox3.Text & "%'"
The filter syntax is explained here: DataColumn.Expression Property (System.Data) | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Thank you for your answer. The filter works. ;) Best regards.