Tommyworker
2019-04-17T09:32:59Z
Hello Igor, long time since last question. Seems you make a good product.
I'm a VB.net Programmer so can you answer me in VB Code, this would be great.
Now the Problem:

I fill a tentec grid with values (integer, long) and add the this value an german curreny (€) and set this
(Value & Currency symbol) as Value for the cell. If i read it i cut the symbol off. It Works fine, but
If i use the Autofilter it sorts the value in the Cell (naturaly) as Text, this not so nice...

Can you explan me in a little snippet how to use the cell with the value and the currency symbol and the Autofilter
sorts the values in the cell as long(single)?
Regards form germany
Igor/10Tec
2019-04-17T11:40:51Z
Sounds like you are placing formatted text values into cells instead of applying a format string to numeric values. Have you tried to store your financial values 'as is' in their native format and apply format strings to them?

Here is an example code demonstrating how to define a column for financial data:

With iGrid1.Cols.Add()
    .Text = "Sums"
    .CellStyle.TextAlign = iGContentAlignment.TopRight
    .CellStyle.FormatString = "{0:€#,##.00}"
End With

Tommyworker
2019-04-17T12:02:25Z
i think i am sitting on it...

For y = 0 To Me.IGrid1.Rows.Count - 1
Me.IGrid1.Cols(i).CellStyle.TextAlign = TenTec.Windows.iGridLib.iGContentAlignment.MiddleCenter
Me.IGrid1.Cols(i).CellStyle.FormatString = "{0:€#,##.00}"
Me.IGrid1.Cells(y, i).Value = CStr((i * 2) + (y * 2))
Next y
PC_10TecCellformat.png

What is my fault, ther is no currency setting? and the sorting of the Autofilter is also wrong
Tommyworker
2019-04-17T12:22:44Z
i got it 🙂 thank you so much
you can close i.
Best regards Thomas
Igor/10Tec
2019-04-17T14:07:22Z
I guess, you meant the statement in which you set the cell value, right?

And there is no need to set the column cell style properties in the loop.

Your code should look like this:

Me.IGrid1.Cols(i).CellStyle.TextAlign = TenTec.Windows.iGridLib.iGContentAlignment.MiddleCenter
Me.IGrid1.Cols(i).CellStyle.FormatString = "{0:€#,##.00}"

For y = 0 To Me.IGrid1.Rows.Count - 1
    Me.IGrid1.Cells(y, i).Value = (i * 2) + (y * 2)
Next y