BindingSource.ResetItem メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > BindingSource.ResetItem メソッドの意味・解説 

BindingSource.ResetItem メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

BindingSource にバインドされたコントロール対し指定したインデックスにある項目を再度読み込んで表示値を更新するよう通知します

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

Public Sub ResetItem ( _
    itemIndex As Integer _
)
Dim instance As BindingSource
Dim itemIndex As Integer

instance.ResetItem(itemIndex)
public void ResetItem (
    int itemIndex
)
public:
void ResetItem (
    int itemIndex
)
public void ResetItem (
    int itemIndex
)
public function ResetItem (
    itemIndex : int
)

パラメータ

itemIndex

変更された項目の、0 から始まるインデックス

解説解説

ResetItem メソッドは、指定されPosition にある項目にバインドされたすべてのコントロール対し、値を更新するよう通知します。これは、ListChangedEventArgs.ListChangedType を ListChangedType.ItemChanged に設定した ListChanged イベント呼び出すことによって行われます

ResetItem は、各項目の値が変更されるたびに、自動的に呼び出されます。ただし、プログラム上でこのメソッド明示的に呼び出すこともできます

使用例使用例

BindingSource コンポーネント使用してリストを DataGridView コントロールバインドするコード例次に示しますリスト変更通知発生させません。したがってBindingSourceResetItem メソッド使用して 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 );
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
BindingSource クラス
BindingSource メンバ
System.Windows.Forms 名前空間
ResetBindings
Position
ListChanged
System.ComponentModel.ListChangedType


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

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

辞書ショートカット

すべての辞書の索引

「BindingSource.ResetItem メソッド」の関連用語

BindingSource.ResetItem メソッドのお隣キーワード
検索ランキング

   

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



BindingSource.ResetItem メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS