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

Cell Formatting

Thread ID:





4098 Apr 28,2003 09:48 PM UTC Apr 29,2003 02:34 PM UTC WinForms 1
Tags: GridControl
Hong Chen
Asked On April 28, 2003 09:48 PM UTC

I wonder how to format a cell to display currency or date. In the samples, the following lines are coded: this[row, col].CellValueType = typeof(double); this[row, col].Format = "C"; ALthough these 2 lines do work, what if the selection contain non-digit data? Things get even worses if I turn on the floatcell model. The attached form illustrates this problem, I had to use try, catch to protect ChangeCells functions. Even this workaround works, When I start to type in the formatted area (in my example, row 1, col 1), another exception strikes. I had to use ThreadException to catch it, otherwise, my system will crash. Please advise. Thanks

Administrator [Syncfusion]
Replied On April 29, 2003 02:34 PM UTC

Hong, I looked into this issue. Regarding the exception not being catched while displaying (or when floating cells are calculated), this was a bug. The exception was not correctly handled and I fixed that. Regarding the issue of users entering text that does not match the cells style, I decided that it is best to add an option that lets you specify whether you want the cell to accept invalid entries as plain string or if a warning message box should be displayed. So, with the 1.6 version (should be out within a week or so) you can then set style.StrictValueType = false. When you do this the text will be stored as string and no warning is displayed. The default behavior will still be that this property is true and a warning message displayed. You will be able to fine tune and further customize this behavior by handling the SaveCellFormattedText event. In this events handler you could then decide on a cell by cell basis what to do and possibly also change the underlying cells CellValueType based on the contents of the input text. See the documentation for SaveCellFormattedText for an example in the 1.6 version then when it is out. Stefan


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