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.

DrawCellDisplayText not called with Format containing #

Thread ID:

Created:

Updated:

Platform:

Replies:

26613 Mar 28,2005 05:02 PM Mar 29,2005 02:05 PM Windows Forms 4
loading
Tags: GridControl
Tom Abraham
Asked On March 28, 2005 05:02 PM

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 05:14 PM

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 06:49 PM

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

Tom Abraham
Replied On March 29, 2005 01:39 PM

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 02:05 PM

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);

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.

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.

;