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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Databoundgrid - constraintexception

Thread ID:





2363 Jan 13,2003 02:26 PM UTC Jan 13,2003 10:37 PM UTC WinForms 1
Tags: GridControl
Pascal Couture
Asked On January 13, 2003 02:26 PM UTC

I have a databound grid to a datatable. The grid display only one column. It display's a combobox to select an item. The selected item is the key to the bound datatable. If the user select's an item that is already in the list and moves to another row or control, vb pop'up an error messagebox. What event can I use to trap this message and display something else?

Administrator [Syncfusion]
Replied On January 13, 2003 10:37 PM UTC

Try handling the CurrentCellValidating event, and checking the value there, and setting e.Canceled = True if the action should be cancelled. You can set the currentcell's ErrorMessage to display a particular message.
private void gridDataBoundGrid2_CurrentCellValidating(object sender, CancelEventArgs e)
	GridCurrentCell cc = this.gridDataBoundGrid2.CurrentCell;
	if(cc.ColIndex == 7)
		string newValue = cc.Renderer.ControlText;
			double d = double.Parse(newValue);
			cc.ErrorMessage = "Not a double...";
			e.Cancel = true;


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon