1,105,290 Community Members

How to set decimal digits to 2 for a double type data field in grid control

Member Avatar
dilip_singh3
Newbie Poster
24 posts since Oct 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I m using VB6 and MS Access.
In MS Access table I have already set the decimal digit to 2 and it is showing only 2 digits after decimal in MS Access Table
but when I put the data in
MSH Flex grid then it shows around 12 to 14 decimal digits.
How to fix this.
Is there any property for grid controls
Or how to resolve through coding.

Please suggest a better site for the study of MSHFlex Grid control..

Thnx.

Member Avatar
hkdani
Posting Pro in Training
433 posts since Nov 2007
Reputation Points: 39 [?]
Q&As Helped to Solve: 46 [?]
Skill Endorsements: 2 [?]
 
0
 

Is there any property for grid controls
Or how to resolve through coding.
Thnx.

use the format function:

format(sngValue, "##.##")

Private Sub Form_Load()
   Dim sngValue as Single 
   sngValue = 52.345
   MSFlexGrid1.Col = 1
   MSFlexGrid1.Row = 1
   MSFlexGrid1.Text = Format(sngValue, "##.##")
End Sub

Notice, you have to set the Column and row you're working with before setting the value of the text.
Check your MSDN documentation of the format property.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article