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

"#" format and 0 in virtual grid

Hi! I am using a virtual grid. One of the cell has e.style.Format = "#". When I put in the value of 0 through code in the cell, it becomes a blank cell. This also happens if you modify the sample grid included with Essential Studio. I am attaching the solution file that should show this. After running the sample, you want to look at cell A4. The cell value is 0.0 and the format is #, but the cell is blank. Thanks for any help! TextFormatVB_30.zip

2 Replies

AD Administrator Syncfusion Team September 27, 2005 11:47 AM UTC

Hi Raymond, Please refer this link : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconstandardnumericformatstrings.asp ( # - Note that this specifier never displays the ''0'' character if it is not a significant digit, even if ''0'' is the only digit in the string.) You could set e.Style.Format=''0'' or try handling the QueryCellFormattedtext and refer this code snippet and let us know if this helps. private void Form1_Load(object sender, System.EventArgs e) { this.gridControl1[3,3].CellValueType = typeof(double); this.gridControl1[3,3].CellValue = 0.0; this.gridControl1[3,3].Format = "#"; } private void gridControl1_QueryCellFormattedText(object sender, Syncfusion.Windows.Forms.Grid.GridCellTextEventArgs e) { if(e.Style.CellValueType == typeof(double)) { double val; val = (double)e.Style.CellValue; e.Text =val.ToString(); e.Handled = true; } } Here is a sample. format.zip Best Regards, Jeba.


AD Administrator Syncfusion Team September 27, 2005 09:29 PM UTC

Thanks for the explanation. We are going to just go with MS''s convention.

Loader.
Live Chat Icon For mobile
Up arrow icon