| View previous topic :: View next topic |
| Author |
Message |
Shawnzzzy Newbie
Joined: 31 Mar 2004 Posts: 3
|
Posted: May 4th, 2004 06:21 PM Post subject: Last name/ first name |
|
|
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 |
|
vbman995 Moderator

Joined: 19 Aug 2005 Posts: 264 Location: Planet Earth
|
Posted: Aug 27th, 2005 10:43 AM Post subject: |
|
|
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 |
|
P.T.A.M. Administrator

Joined: 08 Oct 2003 Posts: 752 Location: Greece
|
Posted: Aug 27th, 2005 10:52 AM Post subject: |
|
|
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  _________________ No one is completely useless. They can at least be an example of what to avoid. |
|
| Back to top |
|
vbman995 Moderator

Joined: 19 Aug 2005 Posts: 264 Location: Planet Earth
|
Posted: Aug 27th, 2005 11:55 AM Post subject: |
|
|
| Sweet!!! I didn't know about that code P.T.A.M. Thanks, I will have to remember it. |
|
| Back to top |
|
P.T.A.M. Administrator

Joined: 08 Oct 2003 Posts: 752 Location: Greece
|
Posted: Aug 27th, 2005 07:29 PM Post subject: |
|
|
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 |
|
|