The Artima Developer Community
Sponsored Link

.NET Buzz Forum
The email I get...

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Duncan Mackenzie

Posts: 689
Nickname: duncanma
Registered: Aug, 2003

Duncan Mackenzie is the Visual Basic Content Strategist at msdn.microsoft.com
The email I get... Posted: Aug 23, 2004 2:24 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Duncan Mackenzie.
Original Post: The email I get...
Feed Title: Code/Tea/Etc...
Feed URL: /msdnerror.htm?aspxerrorpath=/duncanma/rss.aspx
Feed Description: Duncan is the Visual Basic Content Strategist at MSDN, the editor of the Visual Basic Developer Center (http://msdn.microsoft.com/vbasic), and the author of the "Coding 4 Fun" column on MSDN (http://msdn.microsoft.com/vbasic/using/columns/code4fun/default.aspx). While typically Visual Basic focused, his blogs sometimes wanders off of the technical path and into various musing of his troubled mind.
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Duncan Mackenzie
Latest Posts From Code/Tea/Etc...

Advertisement

Every day I get from 1 to 10 emails asking me various VB questions... some I answer by pointing to a link, some by providing code, and sometimes I just point people to the newsgroups or forums that exist for this type of question... but this time I thought I'd just post the question and answer into my blog ...


The Question (edited slightly):
I just want to ask how to make the string in to proper format..
ex...
input.
gerald

this must be the output:
Gerald

and i want it to interactively change when i'm inputing a string in a textbox..

And the answer is to put this code into the TextChanged event of your textbox;

Dim ci As Globalization.CultureInfo = _
    System.Threading.Thread.CurrentThread.CurrentCulture

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles TextBox1.TextChanged
Dim pos As Integer = TextBox1.SelectionStart
TextBox1.Text = ci.TextInfo.ToTitleCase(TextBox1.Text)
If pos > 0 AndAlso pos <= TextBox1.Text.Length Then
TextBox1.SelectionStart = pos
End If
End Sub

The key is that the CultureInfo class provides a TextInfo instance, which in turn has a method of "ToTitleCase" on it... This KB article provides more info and also shows an alternate method to achieve the same results (StrConv()).

Read: The email I get...

Topic: RFDump - The New Type of Criminal in Retail Previous Topic   Next Topic Topic: Chatango

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use