UserControl.AutoValidateChanged 事件

定義

發生於 AutoValidate 屬性變更時。

public:
 event EventHandler ^ AutoValidateChanged;
[System.ComponentModel.Browsable(true)]
public event EventHandler AutoValidateChanged;
[System.ComponentModel.Browsable(true)]
public event EventHandler? AutoValidateChanged;
[<System.ComponentModel.Browsable(true)>]
member this.AutoValidateChanged : EventHandler 
Public Custom Event AutoValidateChanged As EventHandler 

事件類型

屬性

範例

下列程式碼範例示範此成員的使用。 在此範例中,事件處理常式會報告事件發生次數 AutoValidateChanged 。 此報告可協助您瞭解事件發生的時間,並可協助您進行偵錯。 若要報告多個事件或經常發生的事件,請考慮將 取代 MessageBox.ShowConsole.WriteLine 為 或將訊息附加至多行 TextBox

若要執行範例程式碼,請將它貼到包含名為 UserControl1 之型 UserControl 別實例的專案。 然後,確定事件處理常式與事件相關聯 AutoValidateChanged

private void UserControl1_AutoValidateChanged(Object sender, EventArgs e) {

   MessageBox.Show("You are in the UserControl.AutoValidateChanged event.");
}
Private Sub UserControl1_AutoValidateChanged(sender as Object, e as EventArgs) _ 
     Handles UserControl1.AutoValidateChanged

   MessageBox.Show("You are in the UserControl.AutoValidateChanged event.")

End Sub

備註

如果您的自訂控制項執行自己的任何驗證,您必須知道使用控制項的開發人員何時變更 AutoValidate 屬性,以便據以變更控制項的驗證行為。

適用於

另請參閱