BindingSource.ResetItem メソッド
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)


ResetItem メソッドは、指定された Position にある項目にバインドされたすべてのコントロールに対し、値を更新するよう通知します。これは、ListChangedEventArgs.ListChangedType を ListChangedType.ItemChanged に設定した ListChanged イベントを呼び出すことによって行われます。
ResetItem は、各項目の値が変更されるたびに、自動的に呼び出されます。ただし、プログラム上でこのメソッドを明示的に呼び出すこともできます。

BindingSource コンポーネントを使用して、リストを DataGridView コントロールにバインドするコード例を次に示します。リストは変更通知を発生させません。したがって、BindingSource の ResetItem メソッドを使用して ListChanged イベントを発生させます。次のコード例は、「方法 : BindingSource ResetItem メソッドを使用して変更通知を発生させる」で示されている例の一部です。
' This event handler changes the value of the CompanyName ' property for the first item in the list. Private Sub changeItemBtn_Click(ByVal sender As Object, ByVal e As EventArgs) _ Handles changeItemBtn.Click ' Get a reference to the list from the BindingSource. Dim customerList As List(Of DemoCustomer) = _ CType(Me.customersBindingSource.DataSource, List(Of DemoCustomer)) ' Change the value of the CompanyName property for the ' first item in the list. customerList(0).CompanyName = "Tailspin Toys" ' Call ResetItem to alert the BindingSource that the ' list has changed. Me.customersBindingSource.ResetItem(0) End Sub
// This event handler changes the value of the CompanyName // property for the first item in the list. void changeItemBtn_Click(object sender, EventArgs e) { // Get a reference to the list from the BindingSource. List<DemoCustomer> customerList = this.customersBindingSource.DataSource as List<DemoCustomer>; // Change the value of the CompanyName property for the // first item in the list. customerList[0].CompanyName = "Tailspin Toys"; // Call ResetItem to alert the BindingSource that the // list has changed. this.customersBindingSource.ResetItem(0); }
// This event handler changes the value of the CompanyName // property for the first item in the list. void changeItemBtn_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) { // Get a reference to the list from the BindingSource. List< DemoCustomer^ >^ customerList = static_cast<List< DemoCustomer^ >^>( this->customersBindingSource->DataSource); // Change the value of the CompanyName property for the // first item in the list. customerList->default[ 0 ]->CompanyName = L"Tailspin Toys"; // Call ResetItem to alert the BindingSource that the // list has changed. this->customersBindingSource->ResetItem( 0 ); }

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に収録されているすべての辞書からBindingSource.ResetItem メソッドを検索する場合は、下記のリンクをクリックしてください。

- BindingSource.ResetItem メソッドのページへのリンク