Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleMake a TextBox automatically capitalize input in VB .NET
KeywordsNET, uppercase, upper case, lowercase, lower case, capitalize, TextBox, input
CategoriesControls, 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.
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated