i have a textbox i want when i enter cursor previous data automatically claer.
i clear it using backspace. how i will solve it.
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Aug 16, 2012, 1:23 AM EDT
However, you can still use it if you want by wiring it up yourself as Sukesh did.
I'd put this line in the Form's constructor just after the call to InitializeComponent:
pname.GotFocus += new EventHandler(pname_GotFocus);
and then just paste this method into the Form class somewhere:
Alternatively, if you'd prefer to use the Enter event, locate and double click it in the Properties Box to open up a 'skeleton' handler and add the above line to it. You don't need to do anything else as the designer will wire up the event for you by adding the appropriate code to the InitializeComponent method:
Sukesh MarlaRank #461 · 5.4K reputationPosted Aug 15, 2012, 3:37 AM EDT
textBox2.GotFocus += new EventHandler(textBox2_GotFocus);
.
.
Dont forget to check this is correct answer
ta mu198 reputationPosted Aug 15, 2012, 10:18 PM EDT
Santhosh Kumar JayaramanRank #563 · 4.3K reputationPosted Aug 15, 2012, 10:32 PM EDT
ta mu198 reputationPosted Aug 16, 2012, 1:09 AM EDT
ta mu198 reputationPosted Aug 16, 2012, 2:08 AM EDT
in text box on whose enter event i use this code .
now when i enter mouse eprevious data automatically cleared but this error occur now
VulpesRank #55 · 29.2K reputationPosted Aug 16, 2012, 6:42 AM EDT
If that's happening, then it must be due to some other code you have - possibly in the TextChanged or KeyPress eventhandlers, if you have one.