TextBox with default value (1 Viewer)

eugzl

Member
Local time
Today, 09:20
Joined
Oct 26, 2021
Messages
100
In the form I have txtSearch TextBox with according lable. I would like to modify txtSearch TextBox with default text like "Enter search value" with Italic font. In case if someone will start enter just one character the default value will disappear and entered text will have normal font not Italic. And txtSearch become empty default content appears again. If it is possible. How it to do?
Thanks.
 

June7

AWF VIP
Local time
Today, 05:20
Joined
Mar 9, 2014
Messages
4,459
I expect would require code (macro or VBA) setting textbox FontItalic and Value properties in several events.

Conditional Formatting could deal with the italics but code would have to reset Value.

I wouldn't do it. I would just have a label next to textbox.
 

bastanu

AWF VIP
Local time
Today, 06:20
Joined
Apr 13, 2010
Messages
1,207
As June mentioned you' need code in a few events; in the form load or open you'd initialize the default, in the textbox GotFocus or Enter event of the textbox itself you'd erase the default and reset the font to normal then in the AfterUpdate event you'd do your search, move to the found record then empty the textbox and reset the default text and font type (italic).

Cheers,
 

Users who are viewing this thread

Top Bottom