Articles in this section
Category / Section

How to show normal MessageBox instead of showing default ErrorMessageBox for DataValidation?

1 min read

To avoid the default error message box and display the normal message box, use the Cancel property and TableControlCurrentCellErrorMessage event.



//Event Subscription. 
this.gridGroupingControl1.TableControlCurrentCellErrorMessage += newGridTableControlCurrentCellErrorMessageEventHandler(gridGroupingControl1_TableControlCurrentCellErrorMessage); 
void gridGroupingControl1_TableControlCurrentCellErrorMessage(object sender, GridTableControlCurrentCellErrorMessageEventArgs e) 
    //to cancel showing the default ErrorMessageBox support. 
    e.Inner.Cancel = true; 
    //To get the orginal error from e.Inner.Text 
    DialogResult result = MessageBox.Show(e.Inner.Text, "ErrorProvider", MessageBoxButtons.OKCancel); 
    if (result == DialogResult.Cancel) 


'Event Subscription. 
Private Me.gridGroupingControl1.TableControlCurrentCellErrorMessage += New GridTableControlCurrentCellErrorMessageEventHandler(AddressOf gridGroupingControl1_TableControlCurrentCellErrorMessage)
Private Sub gridGroupingControl1_TableControlCurrentCellErrorMessage(ByVal sender As Object, ByVal e As GridTableControlCurrentCellErrorMessageEventArgs)
    'to cancel showing the default ErrorMessageBox support. 
    e.Inner.Cancel = True
    'To get the orginal error from e.Inner.Text 
    Dim result As DialogResult = MessageBox.Show(e.Inner.Text, "ErrorProvider", MessageBoxButtons.OKCancel)
    If result = DialogResult.Cancel Then
    End If
End Sub



Showing error message for Data Validation in GridGrouping control

Sample links:

CS: Custom_Error_Message_Box

VB: Custom_Error_message_box

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment