 |
 |

10-18-2004, 05:29 AM
|
|
Centurion
|
|
Join Date: Jul 2004
Location: Belfast
Posts: 113
|
|
Text Format
|
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?
|
|

10-18-2004, 05:38 AM
|
 |
Lost Soul
Super Moderator * Guru *
|
|
Join Date: May 2001
Location: Vorlon
Posts: 18,929
|
|
|
Because it's only used for databinding and not for formatting.
Use the Format function to format the data
|
|

10-18-2004, 05:42 AM
|
|
Junior Contributor
|
|
Join Date: Feb 2003
Location: Durban, South Africa
Posts: 306
|
|
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.
Code:
Text1.Text = FormatNumber(calcResult, 3)
|
|

10-18-2004, 07:29 AM
|
|
Centurion
|
|
Join Date: Jul 2004
Location: Belfast
Posts: 113
|
|
Grid Format
Quote:
|
Originally Posted by robertdeniro
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.
Code:
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
|
|

10-18-2004, 07:31 AM
|
 |
Lost Soul
Super Moderator * Guru *
|
|
Join Date: May 2001
Location: Vorlon
Posts: 18,929
|
|
Code:
MSFlexGrid.TextMatrix(1,3) = FormatNumber(calcResult, 3)
Have a look at the FlexGrid Functions thread in the Code Library for all kind of Flexgrid samples.
|
|

10-18-2004, 07:54 AM
|
|
Centurion
|
|
Join Date: Jul 2004
Location: Belfast
Posts: 113
|
|
Set at Beginning
Quote:
|
Originally Posted by Flyguy
Code:
MSFlexGrid.TextMatrix(1,3) = FormatNumber(calcResult, 3)
Have a look at the FlexGrid Functions 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
|
|

10-18-2004, 07:58 AM
|
 |
Lost Soul
Super Moderator * Guru *
|
|
Join Date: May 2001
Location: Vorlon
Posts: 18,929
|
|
No it doesn't work that way.
The MSFlexGrid doesn't the have advanced column properties like it's commercial brother the vsFlexGrid.
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.
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
 |
|