Click here to Skip to main content
15,868,096 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
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!!

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


C#
private void textBox1_Click(object sender, EventArgs e)
       {
           textBox1.Text = string.Empty;
       }
 
Share this answer
 
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;
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;
        }
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900