We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

MaskedEditBox and SelectAll

Hi, On Entering my MaskedEditBox control, I want to SelectAll the whole text/mask in the control. So I added a delegate for the "Enter" event and did m_MaskEditCtrl.SelectAll() in OnEnter, but this did not select the whole text. Infact there was no selection at all. What am I doing wrong? Here is the codesnippet: this.Enter += new EventHandler(OnEnter); private void OnEnter(object sender, EventArgs e) { this.SelectAll(); }

3 Replies

AD Administrator Syncfusion Team September 15, 2004 09:34 AM

Hi, You could accomplish this by handling the MaskedEditBox''s GotFous event instead as shown in code below : this.maskedEditBox1.GotFocus += new EventHandler(MaskedEditBox_GotFocus); private void MaskedEditBox_GotFocus(object sender, EventArgs args) { this.maskedEditBox1.SelectAll(); } Please refer to the test sample attached that illustrates this, and let me know if this works for you. Regards, Guru Patwal Syncfusion, Inc.


MB Madhavi Balusu September 15, 2004 09:53 AM

Thanks that works. I have other derived editcontrols which SelectAll in Enter event. This is the only control in which I selectall in GotFocus event. 1) Why, is this your bug? 2) For consistency can I do selectall for other edit controls like CurrencyEdit, DoubleTextBox also in GotFocus event. Or is that a bad idea?


AD Administrator Syncfusion Team September 16, 2004 06:12 AM

Hi, Thanks for the update. 1. Yes, this appears to be a shortcoming in our MaskedEditBox control and we will address this issue in our future releases. 2. You could use either of the 2 events - GotFocus or Enter for our other Editor controls. We appreciate your interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

Loader.
Live Chat Icon For mobile
Up arrow icon