BindingManagerBase.SuspendBinding 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
当在派生类中被重写时,挂起数据绑定。
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
注解
SuspendBinding 是 ResumeBinding 两种方法,允许暂时挂起和恢复数据绑定。 如果必须允许用户在验证之前编辑数据字段,则通常会暂停数据绑定。 例如,用户可能需要根据第二个字段更改字段;否则,验证第一个字段将导致第二个字段出错。