|
|
Title | Make a TextBox automatically capitalize input in VB .NET |
Keywords | NET, uppercase, upper case, lowercase, lower case, capitalize, TextBox, input |
Categories | Controls, VB.NET |
|
|
In VB .NET, the TextBox object has a CharacterCasing property. Simply set it to Upper, Lower, or Normal. If you set this value in code, you should use the constants' fully qualified names as in System.Windows.Forms.CharacterCasing.Upper.
The following shows the code that VB .NET generates for a control where CharacterCasing is set to Upper.
|
|
...
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
...
Me.TextBox2 = New System.Windows.Forms.TextBox()
...
'
'TextBox2
'
Me.TextBox2.CharacterCasing = _
System.Windows.Forms.CharacterCasing.Upper
Me.TextBox2.Location = New System.Drawing.Point(72, 32)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(104, 20)
Me.TextBox2.TabIndex = 2
Me.TextBox2.Text = ""
...
blah, blah, blah
...
|
|
A case where VB .NET is defitely easier than previous versions.
|
|
|
|
|
|