The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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
ADAdministrator Syncfusion Team May 21, 2005 12:10 AM UTC
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.