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

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

BindingManagerBase.CancelCurrentEdit メソッド

派生クラスオーバーライドされると、現在の編集キャンセルします

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

Public MustOverride Sub
 CancelCurrentEdit
Dim instance As BindingManagerBase

instance.CancelCurrentEdit
public abstract void CancelCurrentEdit ()
public:
virtual void CancelCurrentEdit () abstract
public abstract void CancelCurrentEdit ()
public abstract function CancelCurrentEdit
 ()
解説解説
使用例使用例

CancelCurrentEdit メソッドと EndCurrentEdit メソッドコード例次に示しますCancelCurrentEdit メソッド呼び出すと、データ加えた変更破棄されます。EndCurrentEdit メソッド呼び出すと、変更保持されます。

Private Sub CancelEdit()
    ' Gets the CurrencyManager which is returned when the 
    ' data source is a DataView.
    Dim myMgr As BindingManagerBase = _
    CType(BindingContext(myDataView), CurrencyManager)

    ' Gets the current row and changes a value. Then cancels the 
    ' edit and thereby discards the changes.
    Dim tempRowView As DataRowView = _
    CType(myMgr.Current, DataRowView)
    Console.WriteLine("Original: {0}", tempRowView("myCol"))
    tempRowView("myCol") = "These
 changes will be discarded"
    Console.WriteLine("Edit: {0}", tempRowView("myCol"))
    myMgr.CancelCurrentEdit()
    Console.WriteLine("After CanceCurrentlEdit: {0}",
 _
    tempRowView("myCol"))
End Sub

Private Sub EndEdit()
    ' Gets the CurrencyManager which is returned when the 
    ' data source is a DataView.
    Dim myMgr As BindingManagerBase = _
    CType(BindingContext(myDataView), CurrencyManager)

    ' Gets the current row and changes a value. Then ends the 
    ' edit and thereby keeps the changes.
    Dim tempRowView As DataRowView = _
    CType(myMgr.Current, DataRowView)
    Console.WriteLine("Original: {0}", tempRowView("myCol"))
    tempRowView("myCol") = "These
 changes will be kept"
    Console.WriteLine("Edit: {0}", tempRowView("myCol"))
    myMgr.EndCurrentEdit()
    Console.WriteLine("After EndCurrentEdit: {0}",
 _
    tempRowView("myCol"))
End Sub
private void CancelEdit()
{
    // Gets the CurrencyManager which is returned when the 
    // data source is a DataView.
    BindingManagerBase myMgr = 
        (CurrencyManager) BindingContext[myDataView]; 

    // Gets the current row and changes a value. Then cancels the 
    // edit and thereby discards the changes.
    DataRowView tempRowView = (DataRowView) myMgr.Current;
    Console.WriteLine("Original: {0}", tempRowView["myCol"]);
    tempRowView["myCol"] = "These changes will be discarded";
    Console.WriteLine("Edit: {0}", tempRowView["myCol"]);
    myMgr.CancelCurrentEdit();
    Console.WriteLine("After CanceCurrentlEdit: {0}", 
        tempRowView["myCol"]);
}

private void EndEdit()
{
    // Gets the CurrencyManager which is returned when the 
    // data source is a DataView.
    BindingManagerBase myMgr = 
        (CurrencyManager) BindingContext[myDataView];

    // Gets the current row and changes a value. Then ends the 
    // edit and thereby keeps the changes.
    DataRowView tempRowView = (DataRowView) myMgr.Current;
    Console.WriteLine("Original: {0}", tempRowView["myCol"]);
    tempRowView["myCol"] = "These changes will be kept";
    Console.WriteLine("Edit: {0}", tempRowView["myCol"]);
    myMgr.EndCurrentEdit();
    Console.WriteLine("After EndCurrentEdit: {0}", 
        tempRowView["myCol"]);
}

private:
   void CancelEdit()
   {
      // Gets the CurrencyManager which is returned when the
      // data source is a DataView.
      BindingManagerBase^ myMgr = dynamic_cast<CurrencyManager^>(BindingContext[
 myDataView ]);

      // Gets the current row and changes a value. Then cancels the
      // edit and thereby discards the changes.
      DataRowView^ tempRowView = dynamic_cast<DataRowView^>(myMgr->Current);
      Console::WriteLine( "Original: {0}", tempRowView[ "myCol"
 ] );
      tempRowView[ "myCol" ] = "These changes will be discarded";
      Console::WriteLine( "Edit: {0}", tempRowView[ "myCol" ]
 );
      myMgr->CancelCurrentEdit();
      Console::WriteLine( "After CanceCurrentlEdit: {0}", tempRowView[
 "myCol" ] );
   }

   void EndEdit()
   {
      // Gets the CurrencyManager which is returned when the
      // data source is a DataView.
      BindingManagerBase^ myMgr = dynamic_cast<CurrencyManager^>(BindingContext[
 myDataView ]);
      
      // Gets the current row and changes a value. Then ends the
      // edit and thereby keeps the changes.
      DataRowView^ tempRowView = dynamic_cast<DataRowView^>(myMgr->Current);
      Console::WriteLine( "Original: {0}", tempRowView[ "myCol"
 ] );
      tempRowView[ "myCol" ] = "These changes will be kept";
      Console::WriteLine( "Edit: {0}", tempRowView[ "myCol" ]
 );
      myMgr->EndCurrentEdit();
      Console::WriteLine( "After EndCurrentEdit: {0}", tempRowView[ "myCol"
 ] );
   }
private void CancelEdit()
{
    // Gets the CurrencyManager which is returned when the 
    // data source is a DataView.
    BindingManagerBase myMgr = 
        (CurrencyManager)(get_BindingContext().get_Item(myDataView));

    // Gets the current row and changes a value. Then cancels the 
    // edit and thereby discards the changes.
    DataRowView tempRowView = (DataRowView)(myMgr.get_Current());
    
    Console.WriteLine("Original: {0}", tempRowView.get_Item("myCol"));
    tempRowView.set_Item("myCol", "These changes will be discarded");
    Console.WriteLine("Edit: {0}", tempRowView.get_Item("myCol"));
    myMgr.CancelCurrentEdit();
    Console.WriteLine("After CanceCurrentlEdit: {0}", 
        tempRowView.get_Item("myCol"));
} //CancelEdit

private void EndEdit()
{
    // Gets the CurrencyManager which is returned when the 
    // data source is a DataView.
    BindingManagerBase myMgr = 
        (CurrencyManager)(get_BindingContext().get_Item(myDataView));

    // Gets the current row and changes a value. Then ends the 
    // edit and thereby keeps the changes.
    DataRowView tempRowView = (DataRowView)(myMgr.get_Current());
    Console.WriteLine("Original: {0}", tempRowView.get_Item("myCol"));
    tempRowView.set_Item("myCol", "These changes will be kept");
    Console.WriteLine("Edit: {0}", tempRowView.get_Item("myCol"));
    myMgr.EndCurrentEdit();
    Console.WriteLine("After EndCurrentEdit: {0}", 
        tempRowView.get_Item("myCol"));
} //EndEdit
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
BindingManagerBase クラス
BindingManagerBase メンバ
System.Windows.Forms 名前空間
AddNew
EndCurrentEdit
CancelCurrentEdit
IEditableObject



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2024 GRAS Group, Inc.RSS