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
close icon

It is Possible In TextBoxExt Control

1> Change Back Color of TextBox When It has Focus.When
2>I want to move Cursor to next Control as per Tab Index On Enter Key

Thanks In Adavance

1 Reply

AJ Ashwini Jaya Preetha Durai Samy Syncfusion Team January 22, 2015 01:08 PM UTC

Hi Ankit,

Thank you for using Syncfusion products.

Change Back Color of TextBox When It has Focus

Your requirement can be achieved by handling theGotFocus and LostFocus events of TextBoxExt as in below code snippets.

 

Code snippets [C#]

 

// To change the TextBoxExt back color when the focus is lost

        void textBoxExt1_LostFocus(objectsender, EventArgs e)

        {

            this.textBoxExt1.BackColor =Color.WhiteSmoke;

        }

        // To change the BackColor when the Focus is got

        void textBoxExt1_GotFocus(objectsender, EventArgs e)

        {

            this.textBoxExt1.BackColor =Color.LightPink;

        }

 

 

 

I want to move Cursor to next Control as per Tab Index On Enter Key

This stated requirement can be achieved by overriding the ProcessCmdKey function. Below is the code snippet which demonstrate the same

 

// To move the next control in the form while pressing Enter key based on Tab index

        protected override boolProcessCmdKey(ref Message msg, KeyskeyData)

        {

            if (keyData == Keys.Enter)

            {

                SendKeys.Send("{TAB}");              

            }

            return base.ProcessCmdKey(refmsg, keyData);

        }

 

 

 

We have also prepared a sample for your requirement and it can be downloaded from the following link.

Sample location: http://www.syncfusion.com/downloads/support/directtrac/118019/TextBoxSample45871801.zip

 Video location: http://www.syncfusion.com/downloads/support/directtrac/118019/TextBoxExtvideo-1596920084.zip

Please let us know if need further assistance,

Regards,

Ashwini


Loader.
Live Chat Icon For mobile
Up arrow icon