BindingManagerBase.Current プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)


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

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からBindingManagerBase.Current プロパティを検索する場合は、下記のリンクをクリックしてください。

- BindingManagerBase.Current プロパティのページへのリンク