BindingSource.Filter プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > BindingSource.Filter プロパティの意味・解説 

BindingSource.Filter プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

表示する行のフィルタ処理使用する式を取得または設定します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

解説解説
使用例使用例

Filter プロパティSort プロパティコード例次に示します。この例を実行するには、BindingSource1 という名前の BindingSource と、dataGridView1 という名前の DataGridView を含むフォームコード貼り付けます。次にフォーム読み込みイベント処理し読み込みイベント処理メソッドInitializeSortedFilteredBindingSource呼び出します。Visual Basic使用する場合、System.Data.dll への参照追加する必要があります

Private Sub InitializeSortedFilteredBindingSource()

    ' Create the connection string, data adapter and data table.
    Dim connectionString As New
 SqlConnection("Initial Catalog=Northwind;" &
 _
        "Data Source=localhost;Integrated Security=SSPI;")
    Dim customersTableAdapter As New
 SqlDataAdapter("Select * from Customers", _
        connectionString)
    Dim customerTable As New
 DataTable()

    ' Fill the the adapter with the contents of the customer table.
    customersTableAdapter.Fill(customerTable)

    ' Set data source for BindingSource1.
    BindingSource1.DataSource = customerTable

    ' Filter the items to show contacts who are owners.
    BindingSource1.Filter = "ContactTitle='Owner'"
    ' Sort the items on the company name in descending order.
    BindingSource1.Sort = "Country DESC, Address ASC"

    ' Set the data source for dataGridView1 to BindingSource1.
    dataGridView1.DataSource = BindingSource1

   
End Sub

private void InitializeSortedFilteredBindingSource()
{
    // Create the connection string, data adapter and data table.
    SqlConnection connectionString =
         new SqlConnection("Initial Catalog=Northwind;"
 +
         "Data Source=localhost;Integrated Security=SSPI;");
    SqlDataAdapter customersTableAdapter =
        new SqlDataAdapter("Select * from Customers",
 connectionString);
    DataTable customerTable = new DataTable();

    // Fill the the adapter with the contents of the customer table.
    customersTableAdapter.Fill(customerTable);

    // Set data source for BindingSource1.
    BindingSource1.DataSource = customerTable;

    // Filter the items to show contacts who are owners.
    BindingSource1.Filter = "ContactTitle='Owner'";

    // Sort the items on the company name in descending order.
    BindingSource1.Sort = "Country DESC, Address ASC";

    // Set the data source for dataGridView1 to BindingSource1.
    dataGridView1.DataSource = BindingSource1;

}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
BindingSource クラス
BindingSource メンバ
System.Windows.Forms 名前空間
BindingSource.DataSource プロパティ
List
Sort
RemoveFilter
IBindingList.IsSorted



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「BindingSource.Filter プロパティ」の関連用語

BindingSource.Filter プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



BindingSource.Filter プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS