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

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 I know there are variious ways around this.
Thank you,
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

xoperatorConnect With a Mentor Commented:
If you need anything else tell me.

You can use this article to manipulate strings in

Enjoy :)
        Dim sUserName As String = "GMGenius"
        Dim sUserInitial As String = sUserName.Substring(0, 1)

Open in new window

The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

hesConnect With a Mentor Commented:
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

GMGeniusConnect With a Mentor Commented:
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

masterpassConnect With a Mentor Commented:
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

All Courses

From novice to tech pro — start learning today.