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.

MonthCalendar and International format

Thread ID:





1554 Nov 11,2002 11:20 AM Nov 12,2002 09:06 AM Windows Forms 3
Tags: GridControl
Teodorico Morell
Asked On November 11, 2002 11:20 AM

Hi, I’m trying to use the Calendar combo in the grid. I need to allow the user to show only the date or the date and time. If I set the StyleInfo.Format to the same format as the international configuration, it work fines. “MM/dd/yy” or “MM/dd/yy HH:mm” If the user wants to see the column with an other format, let’s say: dd/MM/yy, different to the international configuration, the following exception is thrown: “A first chance exception of type 'System.FormatException' occurred in mscorlib.dll Additional information: String was not recognized as a valid DateTime.” Thanks.

Administrator [Syncfusion]
Replied On November 12, 2002 06:17 AM

This is a defect that we will get corrected. I'll post vback when we have more information on this.

Teodorico Morell
Replied On November 12, 2002 07:56 AM

Our software is at Beta now and we will block the user from changing the date format to other than the specified in the international configuration. When do you think you will be a patch for this? Thanks

Administrator [Syncfusion]
Replied On November 12, 2002 09:06 AM

I am not sure when there will be a patch for this. I think you can work around it by handling the CurrentCellValidating event.
private void gridDataBoundGrid1_CurrentCellValidating(object sender, System.ComponentModel.CancelEventArgs e)
	GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
	GridStyleInfo style = this.gridDataBoundGrid1.Binder.InternalColumns[cc.ColIndex-1].StyleInfo;
	if(cc.Renderer.ControlValue is DateTime)
		string format = style.Format;
		if(format != "")
			DateTimeFormatInfo dtf = new DateTimeFormatInfo();
			dtf.ShortDatePattern = format;
			DateTime dt = DateTime.Parse(this.gridDataBoundGrid1.CurrentCell.Renderer.ControlText, dtf);
	this.gridDataBoundGrid1.CurrentCell.Renderer.Control.Text = dt.ToString();
				MessageBox.Show("bad date");
				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.

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.