Need to get first letter of a a user's first name using vb.net.

Hi,
What I need to do is get the first letter of a user's First name.  For example;  If the user's name is John Smith, then I would need just "J".  I'm using this to create user names for our active directory online web form.  I need the first letter of the user's first name and then add the last name.  So John Smith would be "JSmith".  How can I do this using vb.net. I know there are variious ways around this.
Thank you,
Kouts1
kouts1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

xoperatorCommented:
Hi,

You can use this article to manipulate strings in vb.net:

http://www.vbdotnetheaven.com/Uploadfile/mahesh/StringsinDotnet04212005074227AM/StringsinDotnet.aspx

Enjoy :)
0
xoperatorCommented:
If you need anything else tell me.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GMGeniusSoftware Development Manager/DeveloperCommented:
Simple
        Dim sUserName As String = "GMGenius"
        Dim sUserInitial As String = sUserName.Substring(0, 1)

Open in new window

0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

hesCommented:
Try something like this (not error checked) Not sure how ou are getting the user name but in this example I assign it to a string variable
        Dim strFullUserName As String = "John Smith"  'Get username in variable
        Dim strArrayName() As String = strFullUserName.Split(" ") ' split on a space
        Dim strYourName As String = String.Concat(strArrayName(0).Substring(0, 1), strArrayName(1)) 'Concatenate parts
        MessageBox.Show(strYourName)




0
GMGeniusSoftware Development Manager/DeveloperCommented:
Actually better still

This will deal with Middle names
        Dim sUserName As String = "John Smith"
        Dim sArrayName() As String = sUserName.Split(" ") ' split on a space
        Dim sYourName As String = String.Concat(sArrayName(0).Substring(0, 1), sArrayName(sArrayName.Length - 1))

Open in new window

0
masterpassCommented:
Try this too
Dim Name As String = "John Smith"
Dim Names As String() = Name.Split(" "c)
Dim AdName As String = Names(0).Substring(0, 1) + Names(1)

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.