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. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Messagebox appearing instrad of exception

Thread ID:

Created:

Updated:

Platform:

Replies:

61134 May 18,2007 08:43 AM UTC Jun 19,2007 08:33 PM UTC WinForms 7
loading
Tags: GridControl
haneefm [Syncfusion]
Asked On May 18, 2007 03:00 AM UTC

Hi Steve,

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 = "";
}

Best regards,
Haneef

Steve Rose
Replied On May 18, 2007 08:43 AM UTC

Some of our users are reporting getting a message box appearing, which is not one of ours.

It says:
"Specified argument was out of the range of valid values. Parameter name: rowIndex"

Do you know why this might be appearing instead of throwing an exception to the method which is calling the grid incorrectly?

Is there any way we can track down what's causing it, as there is no stack trace or anything?

We're using a virtual grid if that helps!

Cheers
Steve


Andy D
Replied On June 14, 2007 09:44 AM UTC

Hi,

I'm having the same problem when a user drags info out of the grid and into excel a message box appears.

I can't find a CurrentCellErrorMessage event for a GridControl. Is there another way to trap these messages?

Andy

haneefm [Syncfusion]
Replied On June 14, 2007 05:55 PM UTC

Hi Andy,

The CurrentCellErrorMessage has newly added in Essential Studio V4.2. In older version ( before V4.2 ) , you can customize/avoid the error messagebox in a cell by handling the CurrentCellValidating or CurrentCellValidate or CurrentCellValidateString event in a grid. Please refer to the below KB article for more details.

What are the different validation events and event members? When are they triggered and how are they used?

Best Regards,
Haneef

Andy D
Replied On June 18, 2007 02:15 PM UTC

Hi Haneef,

I implemented the event handlers described above but none of them were hit when I dragged and dropped into Excel. I looked at one of the samples that had d&d and found that it took the values from the cell and moved them rather than copying them. It may be this that is causing the issue I'm seeing (index out of range) because its removing the cells. Is there any way to force it to only copy the contents of the cells rather than move them?

Also, are there any other ways of catching this messageBox as an exception so that it's not shown to the user?

Thanks,

Andy

>Hi Andy,

The CurrentCellErrorMessage has newly added in Essential Studio V4.2. In older version ( before V4.2 ) , you can customize/avoid the error messagebox in a cell by handling the CurrentCellValidating or CurrentCellValidate or CurrentCellValidateString event in a grid. Please refer to the below KB article for more details.

What are the different validation events and event members? When are they triggered and how are they used?

Best Regards,
Haneef

haneefm [Syncfusion]
Replied On June 18, 2007 08:06 PM UTC

Hi Andy,

To turn off style copy/paste support in a gridcontrol(allowing only text to be pasted ), turn off this flag.

this.gridControl1.Model.CutPaste.ClipboardFlags &= ~GridDragDropFlags.Styles;

Best regards,
Haneef

Andy D
Replied On June 19, 2007 03:52 PM UTC

Hi Haneef, this still doesn't fix the underlying issue. The error appears to be an internal one from the Syncfusion grid. Do you know of any other events that I can trap that could handle this?

Thanks,

Andy

haneefm [Syncfusion]
Replied On June 19, 2007 08:33 PM UTC

Hi Andy,

Thank you for your update.

I am not sure of what be might be causing this strange behavior without a working sample. Is it possible for you to upload us a minimal sample to reproduce the issue here? This will help us to analyse the issue further.

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.

Warning Icon 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.Close Icon

;