Mortgage Calculator | The eBay Song | Remortgages | MPAA | Debt Help
Visual Basic reverse string [Archive] - PCMech Forums

PDA

View Full Version : Visual Basic reverse string


jotto84
11-16-2000, 03:42 PM
Hi, i need help, this is a simple project but i have no idea. There is one text box for entering your name, then i want a label box to display it. So it works like this

enter name text1
John Doe

label1
Doe, John

I would use a command button to make this work. Does anyone know what the code it to do that?

farha
11-18-2000, 07:11 PM
Originally posted by jotto84
Hi, i need help, this is a simple project but i have no idea. There is one text box for entering your name, then i want a label box to display it. So it works like this

enter name text1
John Doe

label1
Doe, John

I would use a command button to make this work. Does anyone know what the code it to do that?


Hey, make one txtInput one lblOutput, and one button if you wish to make cmdShow.

Then for coding,
Private Sub Show_Click()
lblOutput.Caption = txtInput.Text

End Sub

albling
11-22-2000, 12:06 AM
farha,

I think it would be a better idea to have 2 or 3 text boxes to store the name of the user, for example: txtFirstName and txtLastName. The reason for this is because you will never know if the user may entered their name differently in different manners.

Then to display the names, in reversed format, the coding is simply,

lblOutput.Caption = trim(txtFirstName.Text) & ", " & _
trim(txtFirstName.Text)

The trim function is to remove any blank space in front and behind the text.

I hope this helps.