Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set control with underscores for spaces

Status
Not open for further replies.

Costefran

Technical User
Jan 2, 2008
197
GB
Can anyone help with the following

I have a form with control "A" and Control "B"

Control A is free type text and I would like to set control "B" as = to control "A" but to insert an underscore whenever a space is entered in control "A"
So, for example, the user enters the following in control A

The Tower of London

and the resulting value in control "B" is seen as

The_Tower_of_London


Any help would be appreciated

Thanks
 
You can try the LostFocus Event.....

Code:
Private Sub Text0_LostFocus()
Me.Text2 = Replace(Me.Text0, Chr(32), "_")
End Sub

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB.NET Programmer
 

any thanks for the help

your suggestion worked immeidately and has saved me many more hours tying to find a resolution on the web

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top