Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Tommyworker  
#1 Posted : Wednesday, April 17, 2019 10:32:59 AM(UTC)
Tommyworker

Rank: Advanced Member

Groups: Registered
Joined: 1/30/2015(UTC)
Posts: 38
Man

Thanks: 7 times
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  
#2 Posted : Wednesday, April 17, 2019 12:40:51 PM(UTC)
Igor/10Tec

Rank: Administration

Groups: Administrators, Forum Moderator
Joined: 1/17/2011(UTC)
Posts: 1,111

Thanks: 15 times
Was thanked: 141 time(s) in 141 post(s)
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:

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

Tommyworker  
#3 Posted : Wednesday, April 17, 2019 1:02:25 PM(UTC)
Tommyworker

Rank: Advanced Member

Groups: Registered
Joined: 1/30/2015(UTC)
Posts: 38
Man

Thanks: 7 times
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  
#4 Posted : Wednesday, April 17, 2019 1:22:44 PM(UTC)
Tommyworker

Rank: Advanced Member

Groups: Registered
Joined: 1/30/2015(UTC)
Posts: 38
Man

Thanks: 7 times
i got it :) thank you so much
you can close i.
Best regards Thomas
Igor/10Tec  
#5 Posted : Wednesday, April 17, 2019 3:07:22 PM(UTC)
Igor/10Tec

Rank: Administration

Groups: Administrators, Forum Moderator
Joined: 1/17/2011(UTC)
Posts: 1,111

Thanks: 15 times
Was thanked: 141 time(s) in 141 post(s)
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:

Code:
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
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.