BindingManagerBase.SuspendBinding 方法

定义

当在派生类中被重写时,挂起数据绑定。

public:
 abstract void SuspendBinding();
public abstract void SuspendBinding ();
abstract member SuspendBinding : unit -> unit
Public MustOverride Sub SuspendBinding ()

示例

void button4_Click( Object^ /*sender*/, EventArgs^ /*e*/ )
{
   try
   {
      BindingManagerBase^ myBindingManager2 = BindingContext[ myDataSet, "Customers" ];
      myBindingManager2->ResumeBinding();
   }
   catch ( Exception^ ex ) 
   {
      MessageBox::Show( ex->Source );
      MessageBox::Show( ex->Message );
   }
}
private void button4_Click(object sender, EventArgs e)
{
   try
   {
      BindingManagerBase myBindingManager2=BindingContext [myDataSet, "Customers"];
      myBindingManager2.ResumeBinding();
   }
   catch(Exception ex)
   {
      MessageBox.Show(ex.Source);
      MessageBox.Show(ex.Message);
   }
}
Private Sub button4_Click(sender As Object, e As EventArgs)
   Try
      Dim myBindingManager2 As BindingManagerBase = BindingContext(myDataSet, "Customers")
      myBindingManager2.ResumeBinding()
   Catch ex As Exception
      MessageBox.Show(ex.Source.ToString())
      MessageBox.Show(ex.Message.ToString())
   End Try
End Sub

注解

SuspendBindingResumeBinding 两种方法,允许暂时挂起和恢复数据绑定。 如果必须允许用户在验证之前编辑数据字段,则通常会暂停数据绑定。 例如,用户可能需要根据第二个字段更改字段;否则,验证第一个字段将导致第二个字段出错。

适用于

另请参阅