Hi,
I'm using wingrid and I want to display number's in their scientific format. When I write for example 10E2, it's automatically displyed as 10000 and I don't want this behavior. Is it possible to avoid this and let cell display 10E2?
Thanks
Set the Format property on the column to "E". Use "E5" if you want to round to 5 significant numbers.
Hi ,
Could you please give more explanation?
I have set this property to "E", nothing changes. Is it e.Cell.Column.Format="E" ?
Thanks.
No, you need to do it on the column.
_grid.DisplayLayout.Bands[0].Columns[0].Format = "E";
Thanks very much for yours advises. I finally choose to put the instruction in InitializeRow(sender, e) method and it work. I notice that, the exponential part is displayed with three digits. Is it possible to reduce it to two or one?
The way the Format property works is that the grid calls the ToString method on the Value property of the cell and passes in the Format. So this will only work if datatype of thecolumn supports the format you are passing in.
Also, Format only applies when the cell is NOT in edit mode. When a cell is in edit mode (when it's the active cell), the mask properties apply, instead.
Is your underlying data in a string or a numeric column? Appying that format will only work if the data is numeric.
Mark
Ok.
I'm sorry to bother you.
Now, i have put the instruction in the InitializeGrid method. Here is some code
Private Sub InitializeGrid() With Me.lvwAnalysisResults.DisplayLayout.Bands(0).Columns("valueColumn") '.Style = ColumnStyle.Double .CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right .Format = "E" End With
.....
When I execute, the number still in the digital format, nothing changes. Am I wrong with my code?
Thanks very much
No, you can't do this for the ActiveCell. Format only applies to cells that are not in edit mode. There's no built-in way to edit a number in scientific notation.