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.

Cell validation message box

Thread ID:

Created:

Updated:

Platform:

Replies:

53156 Dec 8,2006 04:45 PM Jan 29,2007 03:09 PM Windows Forms 3
loading
Tags: GridControl
Jarrod Peace
Asked On December 8, 2006 04:45 PM

Hello,

I know that this has been covered in these forums, but I have not been able to get it working right. All I want to do is prevent the "Input was not in correct format" messagebox from appearing at all when an invalid input is entered in a GC. My problem is that this message is appearing when users are entering blanks, which is not desirable for our application. I would rather catch this message and clear out the contents of the cell on invalid input with no message. Any help on this would be greatly appreciated. Thanks in advance.

Jarrod

Administrator [Syncfusion]
Replied On December 8, 2006 07:34 PM

One way you can try to do this is to handle the CurrentCellErrorMessage event. You can cancel this event to avoid the error message displaying. You can also reset the current text if you want to. Here is some code snippets.

private void Form1_Load(object sender, EventArgs e)
{
//make all cells doubles so errors are generated when you type something other than a double
this.gridControl1.TableStyle.CellValueType = typeof(double);

gridControl1.CurrentCellErrorMessage += new GridCurrentCellErrorMessageEventHandler(grid_CurrentCellErrorMessage);
}

void grid_CurrentCellErrorMessage(object sender, GridCurrentCellErrorMessageEventArgs e)
{
e.Cancel = true;
this.gridControl1.CurrentCell.Renderer.Control.Text = "";
}

James Blibo
Replied On January 29, 2007 02:18 PM

How can I customize the tooltip message that is show? I want to add something like 'Press ESC' to cancel changes' for example to the message. Maybe even the column name!

Administrator [Syncfusion]
Replied On January 29, 2007 03:09 PM

Hi James,

If you want to change the error tooltip text in a grid then you can hanlde the TableControlCurrentCellErrorMessage and set the custom error tooltip using CurrentRecordProperty.Exception property. Here is a code snippet to show this.

private void gridGroupingControl1_TableControlCurrentCellErrorMessage(object sender, GridTableControlCurrentCellErrorMessageEventArgs e)
{
GridGroupingControl grid = sender as GridGroupingControl;
foreach(CurrentRecordProperty prop in grid.Table.CurrentRecordManager.Properties)
{
if( prop.IsError)
prop.Exception = new Exception("Your ToolTip Message Here",prop.Exception.InnerException);
}
}

Best Regards,
Haneef

CONFIRMATION

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.

;