Problem with textBox selectAll


i have problem textbox selectall function, want

on textbox single click event want text box selectall text in textbox textbox.selectall

but on second click want unselectall text in textbox.

i did codding in click event of textbox below code

textbox1.selectall();

but select text inside textbox click on textbox

can 1 me problem

hi xabi,

you want selectall when first click textbox , unselectall when second click textbox. think can try code boelow:

public form2()         {             initializecomponent();             textbox2.text = "auto select text demo";             textbox2.tag = false;             textbox2.gotfocus += new eventhandler(textbox2_gotfocus);             textbox2.mouseup += new mouseeventhandler(textbox2_mouseup);                    } void textbox2_mouseup(object sender, mouseeventargs e)         {             if (e.button == mousebuttons.left && (bool)textbox2.tag == true)             {                 textbox2.selectall();             }             textbox2.tag = false;         }         void textbox2_gotfocus(object sender, eventargs e)         {             textbox2.tag = true;                textbox2.selectall();           }
thanks.

<the content provided "as is" without warranty of kind, whether express or implied>
thanks
msdn community support

please remember "mark answer" responses resolved issue. common way recognize have helped you, , makes easier other visitors find resolution later.



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

  1. I feel there is a need to provide more and more information about SQL and more aspects of SOAP and REST.Specifically because these interfaces or tools are very useful always.

    SQL Server Load Soap Api

    ReplyDelete

Post a Comment

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

How to Share webservice object to all user