Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » .NET General

Post new topic   Reply to topic
Last name/ first name
View previous topic :: View next topic  
Author Message
Shawnzzzy
Newbie


Joined: 31 Mar 2004
Posts: 3

PostPosted: May 4th, 2004 06:21 PM    Post subject: Last name/ first name Reply with quote

Hi,

In a program being build I would like in the program after a user has entered their name (John Doe) into a textbox to display their name also in a label but I would like it to appear (Doe, John).

I almost have it working but its giving me some hassle.
Any help would be appreciated.
thanks
Back to top
View user's profile Send private message
vbman995
Moderator


Joined: 19 Aug 2005
Posts: 264
Location: Planet Earth

PostPosted: Aug 27th, 2005 10:43 AM    Post subject: Reply with quote

What about having 2 textboxes. One for the first name and one for the second name. You could then have your code like this:

(text1 is the first name
text2 is the last name)

Code:

firstname = text1.text
lastname = text2.text
Label1.Caption = lastname + ",  " + firstname


That might work....
Back to top
View user's profile Send private message
P.T.A.M.
Administrator


Joined: 08 Oct 2003
Posts: 752
Location: Greece

PostPosted: Aug 27th, 2005 10:52 AM    Post subject: Reply with quote

Have a look at this :

Code:
    Dim sFlipName() As String
   
    sFlipName = Split(Text1.Text, " ")
   
    Text1.Text = sFlipName(1) & ", " & sFlipName(0)


You might want to check that there actually is a " " (space) character in the textbox or you'll get an error Smile
_________________
No one is completely useless. They can at least be an example of what to avoid.
Back to top
View user's profile Send private message Send e-mail Visit poster's website ICQ Number
vbman995
Moderator


Joined: 19 Aug 2005
Posts: 264
Location: Planet Earth

PostPosted: Aug 27th, 2005 11:55 AM    Post subject: Reply with quote

Sweet!!! I didn't know about that code P.T.A.M. Thanks, I will have to remember it.
Back to top
View user's profile Send private message
P.T.A.M.
Administrator


Joined: 08 Oct 2003
Posts: 752
Location: Greece

PostPosted: Aug 27th, 2005 07:29 PM    Post subject: Reply with quote

Actually I just noticed that this is in the .Net section and what I posted I tested in VB6. I don't know if it will work in .Net exactly as it is. It might need some slight modifications.
_________________
No one is completely useless. They can at least be an example of what to avoid.
Back to top
View user's profile Send private message Send e-mail Visit poster's website ICQ Number
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » .NET General All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic