本文整理匯總了VB.NET中System.Windows.Forms.ValidationConstraints枚舉的典型用法代碼示例。如果您正苦於以下問題:VB.NET ValidationConstraints枚舉的具體用法?VB.NET ValidationConstraints怎麽用?VB.NET ValidationConstraints使用的例子?那麽, 這裏精選的枚舉代碼示例或許可以為您提供幫助。
在下文中一共展示了ValidationConstraints枚舉的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Main
' 導入命名空間
Imports System.Drawing
Imports System.Windows.Forms
Namespace ValidateChildrenWithConstraints
_
Class Form1
Inherits Form
Public Overloads Shared Sub Main(ByVal args() As String)
Application.EnableVisualStyles()
Application.Run(New Form1())
End Sub
Private Sub New()
AddHandler Me.Load, AddressOf Form1_Load
End Sub
Dim WithEvents TextBox1, TextBox2, TextBox3 As TextBox
Dim FlowPanel1 As FlowLayoutPanel
Dim WithEvents SubTextBox1 As TextBox
Dim WithEvents Button1 As Button
Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
' Create controls on form.
Me.Size = New Size(500, 300)
Me.AutoValidate = AutoValidate.Disable
TextBox1 = New TextBox()
TextBox1.Location = New Point(20, 20)
TextBox1.Size = New Size(75, TextBox1.Size.Height)
TextBox1.CausesValidation = True
Me.Controls.Add(TextBox1)
TextBox2 = New TextBox()
TextBox2.Location = New Point(105, 20)
TextBox2.Size = New Size(75, TextBox2.Size.Height)
TextBox2.CausesValidation = True
Me.Controls.Add(TextBox2)
TextBox3 = New TextBox()
TextBox3.Location = New Point(190, 20)
TextBox3.Size = New Size(75, TextBox3.Size.Height)
TextBox3.Enabled = False
TextBox3.CausesValidation = True
Me.Controls.Add(TextBox3)
Button1 = New Button()
Button1.Text = "Click"
Button1.Location = New Point(270, 20)
Me.Controls.Add(Button1)
FlowPanel1 = New FlowLayoutPanel()
FlowPanel1.Size = New Size(400, 100)
FlowPanel1.Dock = DockStyle.Bottom
SubTextBox1 = New TextBox()
SubTextBox1.CausesValidation = True
FlowPanel1.Controls.Add(SubTextBox1)
Me.Controls.Add(FlowPanel1)
End Sub
Sub SubTextBox1_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SubTextBox1.Validating
MessageBox.Show("SubTextBox1 Validating!")
End Sub
Sub TextBox1_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating
MessageBox.Show("TextBox1 Validating!")
End Sub
Sub TextBox2_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TextBox2.Validating
MessageBox.Show("TextBox2 Validating!")
End Sub
Sub TextBox3_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TextBox3.Validating
MessageBox.Show("TextBox3 Validating!")
End Sub
Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
Me.ValidateChildren((ValidationConstraints.ImmediateChildren Or ValidationConstraints.Enabled))
End Sub
End Class
End Namespace 'ValidateChildrenWithConstraints