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

DrawCellDisplayText not called with Format containing #

Thread ID:





26613 Mar 28,2005 10:02 PM UTC Mar 29,2005 07:05 PM UTC WinForms 4
Tags: GridControl
Tom Abraham
Asked On March 28, 2005 10:02 PM UTC

I have a grid containing FormulaCells. For most of the cells I specify a .Format of ''N0'' or ''P1''. However, I also need to use ''#,''. I handle the DrawCellDisplayText event on the grid. When .Format is set to something that starts with #, the DrawCellDisplayText event is never raised for cells that have a zero or empty value. I''m not sure that there isn''t more to it, but if I change .Format from ''#,'' to ''0#,'' then DrawCellDisplayText again starts being raised for zero or empty cells.

Tom Abraham
Replied On March 28, 2005 10:14 PM UTC

I''m not sure what the subtlety is in what the grid is doing, but this format ''#,##0,'' appears to work normally, while ''#,###,'' causes DrawCellDisplayText to not be raised. Perhaps because the grid is testing for an empty string?

Administrator [Syncfusion]
Replied On March 28, 2005 11:49 PM UTC

You are correct. If the text is empty, DrawCellDisplayText is not raised.

Tom Abraham
Replied On March 29, 2005 06:39 PM UTC

Trouble is, the value in these cells is 0. If you go to the cell and hit edit, a zero is displayed for edit. Hit Enter, and the cell goes blank. That''s a problem.

Administrator [Syncfusion]
Replied On March 29, 2005 07:05 PM UTC

If you want to see a 0, then I think you will have to use #,##0. The behavior is from the .NET Framework. You see the same behvior if you try to format a zero with string.Format. Drop 3 lables on a form and add this code to the form load. The only one that shows a zero is the one with 0 in teh format. double d = 0; this.label1.Text = string.Format("{0:#,###,}", d); this.label2.Text = string.Format("{0:#,##0,}", d); this.label3.Text = string.Format("{0:#,###}", d);


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