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.
Unfortunately, activation email could not send to your email. Please try again.

Selection of text in current cell

Thread ID:





29278 May 20,2005 01:25 PM May 20,2005 08:10 PM Windows Forms 1
Tags: GridControl
Jeff Lancaster
Asked On May 20, 2005 01:25 PM

Hello, I am using the following code in my GDBG so that when cell validation fails, it will display an error message and then highlight all the text in the current cell. It works fine if the user tries to tab or enter out of the cell, but if the user clicks on another cell, the message is displayed, however the text does not get highlighted. I tried playing with the "focus" method but haven''t had any luck yet. Suggestions? Private Sub m_grid_ValidateFailed(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridValidateFailedEventArgs) Handles m_grid.ValidateFailed Dim cc As GridCurrentCell = m_grid.CurrentCell cc.ErrorMessage = "Invalid value for " & m_grid.GridBoundColumns(cc.ColIndex - 1).HeaderText Dim tb As GridTextBoxControl = CType(cc.Renderer.Control, GridTextBoxControl) tb.SelectAll() e.Handled = True End Sub

Administrator [Syncfusion]
Replied On May 20, 2005 08:10 PM

Probably what is happening is that the text is selected immediately in your code, an dthen this gets undone when the error message is displayed later. Something to try. Instead of setting cc.ErrorMessage = "Invalid value for " & m_grid.GridBoundColumns(cc.ColIndex - 1).HeaderText go ahead and do a MessageBox.Show to display the message in your ValiedateFailed handler, then do the code that selects the text.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.