We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,703 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

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

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.

2
Contributors
1
Reply
12 Hours
Discussion Span
5 Years Ago
Last Updated
2
Views
dilip_singh3
Newbie Poster
24 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 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.

hkdani
Posting Pro in Training
439 posts since Nov 2007
Reputation Points: 61
Solved Threads: 48
Skill Endorsements: 2

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page generated in 0.3029 seconds using 2.65MB