过滤datagrid但在VB.NET中 [英] Filter datagrid but in VB.NET
本文介绍了过滤datagrid但在VB.NET中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大师!
我想看一个示例项目代码,但对于 VB.NET 来说,该代码说明如何使用文本框中的值过滤数据网格的内容.
在此站点中浏览的是一种出色的语言,但是使用C#.
如果有人在 VB.NET pls中有任何示例,请让我知道它在哪里...这个菜鸟将欣赏它一百万次.
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.
推荐答案
如果您在C#中有一些出色的想法,但是无法将其转换为C#,则应该那里有[在线代码转换器] [ ^ ]将C#代码转换为vb.net代码.随便
尝试在vb.net中给定的代码
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
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
我认为您的网格的数据源是数据表或数据集
您应该阅读dataview,这是一个示例 Dataview [ ^ ]
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 [^]
这篇关于过滤datagrid但在VB.NET中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文