本文整理汇总了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
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:88,代码来源:ValidationConstraints
注:本文中的System.Windows.Forms.ValidationConstraints枚举示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论