Hi All,

There are many articles available that describe how textbox watermark can be done with the .Net framework(C# and VB.Net)

I'm working on a VB6 project. How to implement this with a VB6 textbox?

Thanks AndreRet,

My aim is to not have labels with adjacent textboxes. I need to save space(width wise). So I envisage having a TextBox which will have text for eg. 'Enter your name' in light gray colour. The moment the user clicks on it, the text should vanish.

Microsoft on their website http://www.microsoft.com/en-us/default.aspx has Search Microsoft.com. This is how I wish my TextBox to function.

The example you gave has an image in the backgroud. That's not what I want. But the example form (frmTextBoxBack) mentions VBAccelerator. :) In fact I want to use the above style with the VBAccelerator's SGrid2 control!

Hope for a solution....

I see, quite easy then. :)

In your textbox "Text" property add - "Enter your name"

In your textbox Gotfocus event, the following -

If Text1.Text = "Enter your name" then
    Text1.Text = vbNullstring
End If
Comments
made it look so easy.

Thanks AndreRet
I had thought that I had needed to change the font of the textbox to grey colour. But then I just set the colour of the SGrid2 control to grey

.ForeColor = vbGrayText

and left the textbox with the default black font. So I really did not need to do it the way I was planning to do initially.

Your solution would definetly work...Thanks again

This question has already been answered. Start a new discussion instead.