Default text in a textbox that disappears on click (like a search box) (1 Viewer)

Zak14

Registered User.
Local time
Today, 23:47
Joined
Jun 27, 2014
Messages
166
Hi guys,

Is there an efficient way anyone knows of, to have default text in a textbox on my form (like a search box), but have it so that when a user focuses on the textbox (to type in a search term), the word should disappear.

Just like the search box on windows 7 start menu.

Then, is there a way to have the default text not be the actual text in the box? Otherwise, my search box will search the default text.

Thanks!
 

burrina

Registered User.
Local time
Today, 17:47
Joined
May 10, 2014
Messages
972
Sure. Just create a label and then use the OnGotFocusEvent to make it invisible.
Example: lblytd
OnMouseDownEvent
OnMouseMoveEvent
Me.lblytd.Visible = False

OnLostFocusEvent of Control
OnMouseDownEvent
OnMouseMoveEvent

Me.lblytd.Visible = True
OnEnter Me.lblytd.Visible = False
OnExit Me.lblytd.Visible= True

HTH
 

spikepl

Eledittingent Beliped
Local time
Tomorrow, 00:47
Joined
Nov 3, 2010
Messages
6,142
In the textbox's Format property, put

@;"my default text"
 

Users who are viewing this thread

Top Bottom