本文整理汇总了VB.NET中System.Windows.Forms.BindingSource.Filter属性的典型用法代码示例。如果您正苦于以下问题:VB.NET BindingSource.Filter属性的具体用法?VB.NET BindingSource.Filter怎么用?VB.NET BindingSource.Filter使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Windows.Forms.BindingSource 的用法示例。
在下文中一共展示了BindingSource.Filter属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: PopulateDataViewAndFilter
Private Sub PopulateDataViewAndFilter()
Dim set1 As New DataSet()
' Some xml data to populate the DataSet with.
Dim musicXml As String = "<?xml version='1.0' encoding='UTF-8'?>" & _
"<music>" & _
"<recording><artist>Coldplay</artist><cd>X&Y</cd></recording>" & _
"<recording><artist>Dave Matthews</artist><cd>Under the Table and Dreaming</cd></recording>" & _
"<recording><artist>Dave Matthews</artist><cd>Live at Red Rocks</cd></recording>" & _
"<recording><artist>Natalie Merchant</artist><cd>Tigerlily</cd></recording>" & _
"<recording><artist>U2</artist><cd>How to Dismantle an Atomic Bomb</cd></recording>" & _
"</music>"
' Read the xml.
Dim reader As New StringReader(musicXml)
set1.ReadXml(reader)
' Get a DataView of the table contained in the dataset.
Dim tables As DataTableCollection = set1.Tables
Dim view1 As New DataView(tables(0))
' Create a DataGridView control and add it to the form.
Dim datagridview1 As New DataGridView()
datagridview1.AutoGenerateColumns = True
Me.Controls.Add(datagridview1)
' Create a BindingSource and set its DataSource property to
' the DataView.
Dim source1 As New BindingSource()
source1.DataSource = view1
' Set the data source for the DataGridView.
datagridview1.DataSource = source1
' The Filter string can include Boolean expressions.
source1.Filter = "artist = 'Dave Matthews' OR cd = 'Tigerlily'"
End Sub
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:38,代码来源:BindingSource.Filter
注:本文中的System.Windows.Forms.BindingSource.Filter属性示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论