Text Format

GerardMcL
10-18-2004, 05:29 AM
Hi,
I have a TextBox1, I set its properties -> DataField = Number with 3 Decimal Places

When the form opens a calculation is executed and it fills the Text box - the result of the calculation is
58.0000192802 (Or something like that)
And this is exactly how it appears in the Text Box

Why, Oh Why doesn't it format it to 3 decimal places?

Flyguy
10-18-2004, 05:38 AM
Because it's only used for databinding and not for formatting.
Use the Format function to format the data

robertdeniro
10-18-2004, 05:42 AM
The DataFormat property is only used when a control is bound to a datasource.

You need to use a function like FormatNumber to do this.

Text1.Text = FormatNumber(calcResult, 3)

GerardMcL
10-18-2004, 07:29 AM
The DataFormat property is only used when a control is bound to a datasource.

You need to use a function like FormatNumber to do this.

Text1.Text = FormatNumber(calcResult, 3)



Thanks for all the replies lads, now If I knew how to format a column in a MSFlexgrid everything would be just peachy creamy

Flyguy
10-18-2004, 07:31 AM
MSFlexGrid.TextMatrix(1,3) = FormatNumber(calcResult, 3)

Have a look at the .. thread in the Code Library for all kind of Flexgrid samples.

GerardMcL
10-18-2004, 07:54 AM
MSFlexGrid.TextMatrix(1,3) = FormatNumber(calcResult, 3)

Have a look at the .. thread in the Code Library for all kind of Flexgrid samples.

Using one of the samples you placed on the tutorial ( thanks for that by the way )
I set the width and headings at Load()
Can I set the column width then

MSFlexGrid1.Col(1) = FormatNumber( ,3)
Im sure this wont work, but can it be done

Flyguy
10-18-2004, 07:58 AM
No it doesn't work that way.
The MSFlexGrid doesn't the have advanced column properties like it's commercial brother the vsFlexGrid (www.componentone.com).

You either have to loop through all values of the Flexgrid and reformat these values or format the values when they are assigned to the grid.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum