Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Text Strings in vb.net 2005

Status
Not open for further replies.

JimRockford0924

Programmer
Jan 26, 2008
10
US
I need to find out to make the first letter of a string uppercase while leaving the rest as is. This is necessary for customer names, vendor names, etc. Can anyone help?
 
One way

Code:
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim str As String = "david"
        Dim l As String = UCase(str.Substring(0, 1))
        MsgBox(l + str.Substring(1))
    End Sub
End Class

-David
2006, 2007 & 2008 Microsoft Most Valuable Professional (VB)
2006 Dell Certified System Professional (CSP)
 
It's even easier, take a lok at the strConv function:

dim S as String
S = StrConv(S, vbProperCase)

You can also use the above with text boxes, etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top