Click here to Skip to main content
15,884,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Gurus!!

I want to see an example project code but for VB.NET on how to filter contents for a datagrid using values coming from a textbox.

Browsing in this site there is one excellent but in C#.

If anyone has any example in VB.NET pls let me know where it is...this rookie will appreciatte it a million times.
Posted

If you have some excellent Ideas in C# and you are not able to convert it in to C# then you should go there-[OnLine Code Converter][^] to convert C# code to vb.net code. whatever
Try given code in vb.net
VB
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
 
        Try
            DataGridViewForm.YourBindingSource.Filter = String.Format("{0} = '{1}'", _
DataGridViewForm.YourDataSet.YourTable.Columns(columnIndex).ColumnName.ToString, TextBox1.Text)
        Catch
            MessageBox.Show("Database error")
        End Try
        Me.Close()
    End Sub
 
Share this answer
 
Comments
thatraja 24-Jun-11 23:02pm    
5!
I have assumed that your datasource for the grid is a datatable or dataset

you should read up on dataview, here is an example Dataview [^]
 
Share this answer
 
v2
Comments
thatraja 24-Jun-11 23:02pm    
5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900