BindingManagerBase.SuspendBinding 方法

定义

当在派生类中被重写时,挂起数据绑定。When overridden in a derived class, suspends data binding.

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 是两种使数据绑定暂时挂起和恢复的方法。SuspendBinding and ResumeBinding are two methods that allow the temporary suspension and resumption of data binding. 如果在进行验证之前必须允许用户编辑数据字段,通常会挂起数据绑定。You would typically suspend data binding if the user must be allowed to edit data fields before validation occurs. 例如,用户可能需要将字段更改为与第二个字段一致;否则,验证第一个字段将导致第二个字段出现错误。For example, the user might need to change a field to be in accordance with a second field; otherwise, validating the first field would cause the second field to be in error.

适用于

另请参阅