本文整理汇总了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