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

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

BindingManagerBase.Current プロパティ

派生クラスオーバーライドされると、現在のオブジェクト取得します

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

解説解説

Current オブジェクトには、データ ソース現在の項目の値を格納します現在の項目の値を使用するには、その項目を DataSource が格納しているオブジェクトTypeキャストする必要があります。たとえば、DataTable が DataRowView オブジェクト格納してます。現在のオブジェクトの型を確認するには、GetType メソッドおよび ToString メソッド使用します

メモメモ

DataSourceDataSet、DataViewManager、または DataTable場合は、実際には DataView にバインドます。たがって、各 Current オブジェクトDataRowView オブジェクトです。

使用例使用例

CurrentChanged イベントで BindingManagerBase の Current オブジェクトの値を出力するコード例次に示します。この例では、データ ソースCustName という名前の DataColumn がある DataTable であることを前提にしています。

Private Sub Current_Changed(sender As
 Object, e As EventArgs)
    Dim bm As BindingManagerBase = CType(sender,
 BindingManagerBase)
    ' Check the type of the Current object. If it is not a
    ' DataRowView, exit the method. 
    If Not bm.Current.GetType() Is
 GetType(DataRowView) Then
        Return
    End If 
    ' Otherwise, print the value of the column named "CustName".
    Dim drv As DataRowView = CType(bm.Current,
 DataRowView)
    Console.Write("CurrentChanged): ")
    Console.Write(drv("CustName"))
    Console.WriteLine()
End Sub 'Current_Changed
private void Current_Changed(object sender,
 EventArgs e)
{
    BindingManagerBase bm = (BindingManagerBase) sender;
    /* Check the type of the Current object. If it is not a 
    DataRowView, exit the method. */
    if(bm.Current.GetType() != typeof(DataRowView)) return;

    // Otherwise, print the value of the column named "CustName".
    DataRowView drv = (DataRowView) bm.Current;
    Console.Write("CurrentChanged): ");
    Console.Write(drv["CustName"]);
    Console.WriteLine();
}
void Current_Changed( Object^ sender, EventArgs^ /*e*/ )
{
   BindingManagerBase^ bm = dynamic_cast<BindingManagerBase^>(sender);
   
   /* Check the type of the Current object. If it is not a 
           DataRowView, exit the method. */
   if ( bm->Current->GetType() != DataRowView::typeid )
         return;

   // Otherwise, print the value of the column named "CustName".
   DataRowView^ drv = dynamic_cast<DataRowView^>(bm->Current);
   Console::Write( "CurrentChanged): " );
   Console::Write( drv[ "CustName" ] );
   Console::WriteLine();
}
private void Current_Changed(Object sender,
 EventArgs e)
{
    BindingManagerBase bm = (BindingManagerBase)sender;
    /* Check the type of the Current object. If it is not a 
       DataRowView, exit the method. 
     */
    if (!bm.get_Current().GetType().Equals(DataRowView.class.ToType()))
 {
        return;
    }
    // Otherwise, print the value of the column named "CustName".
    DataRowView drv = (DataRowView)(bm.get_Current());
    Console.Write("CurrentChanged): ");
    Console.Write(drv.get_Item("CustName"));
    Console.WriteLine();
} //Current_Changed
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
BindingManagerBase クラス
BindingManagerBase メンバ
System.Windows.Forms 名前空間
CurrentChanged
Position


このページでは「.NET Framework クラス ライブラリ リファレンス」からBindingManagerBase.Current プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からBindingManagerBase.Current プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からBindingManagerBase.Current プロパティ を検索

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

辞書ショートカット

すべての辞書の索引

「BindingManagerBase.Current プロパティ」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS