Click here to Skip to main content
14,668,067 members
Rate this:
Please Sign up or sign in to vote.
See more:
Can someone help me with thos problem:
how can i make a text disapear when I click on the text field ?
Posted
Comments
Sandeep Mewara 30-Apr-11 13:23pm
   
Elaborte!
Wonde Tadesse 30-Apr-11 13:28pm
   
Not clear!
Groulien 30-Apr-11 14:07pm
   
Not clear?
He wants to make the text disappear when clicked upon, in what way do you want him to elaborate?
Is this simple curiosity or are you trying to solve a problem?
If you're trying to solve a problem, try posting the problem as well, it may lead to very graceful solutions (as in user friendly).
anyavacy 1-May-11 6:41am
   
I go ta solution from one of the answers provided.
the problem is that I have a text field and before inserting things in the data base i have to check that the right values are inserted in the text fields. thank you anyways!!

Rate this:
Please Sign up or sign in to vote.

Solution 1

try this :)
textBox1.Click += new EventHandler(textBox1_Click);


private void textBox1_Click(object sender, EventArgs e)
       {
           textBox1.Text = string.Empty;
       }
   
Comments
Groulien 30-Apr-11 14:02pm
   
If you want to keep the data stored inside, change
textBox1.Text = string.Empty;
to
textBox1.Visible = false;
Rate this:
Please Sign up or sign in to vote.

Solution 2

On your textbox or Richtexbox or text field Click Event Write These :
string TEXT="Some Text BLA BLA";
 private void richNote_Click(object sender, EventArgs e)
        {
            richNote.Text=TEXT;
        }
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100