MSHFlexgrid problem with decimal values

Posted on 2002-04-12
Last Modified: 2012-06-27
I've a MSHFlexgrid connected to a ADODB.recordset that retrieve decimal numbers.
But the MSHFlexgrid doesn't show them with the comma, only with the dot.

How can a solve this problem.
I've tried the datagrid, and MFlexgrid and they show the values just fine.

Question by:asimoes
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 70

Accepted Solution

Éric Moreau earned 200 total points
ID: 6936641
you can loop through the lines and columns of your grid and use the Format function to display what you want:

With mshfgMB
   For intLine = gkbytStartLine To .Rows - 1
      For intCol = gkbytStartCol To .Cols - 1
        .TextMatrix(intLine, intCol) = Format(sngTotal, "###,##0.0000")
End With

Expert Comment

ID: 6936642
hi asimoes,
If u take my advice,dont connect mshfgrid to recordset
instead write ur code,it is not big dealwriteing few lines,the flexibility it gives is high and u can play around the u want.
if u want to merge repeated rows then use merge property.
what ever data u put will be in text,u can format  it the way u want.
if u want further help reply back.
This advice should help u

Expert Comment

ID: 6936655
'This code I have used inmy project,It can help u in coding
'U could even write lean code(reduced lines)  'ur 'requirements are simple

Private Sub showsales(rsshowsales As ADODB.Recordset)
   Dim i As Integer
   hfgridSales.Rows = rsshowsales.RecordCount + 1
   With hfgridSales
       For i = 1 To .Rows - 1
       .TextMatrix(i, 0) = rsshowsales.Fields(2)
       .TextMatrix(i, 1) = Format(rsshowsales.Fields(0), "dd/mmm/yyyy")
       .TextMatrix(i, 2) = rsshowsales.Fields(1)
       .TextMatrix(i, 3) = rsshowsales.Fields(9)
       .TextMatrix(i, 4) = rsshowsales.Fields(10)
       .TextMatrix(i, 5) = rsshowsales.Fields(11)
       .TextMatrix(i, 6) = rsshowsales.Fields(3)
       .TextMatrix(i, 7) = rsshowsales.Fields(4)
       .TextMatrix(i, 8) = rsshowsales.Fields(5)
       .TextMatrix(i, 9) = rsshowsales.Fields(6)
       .TextMatrix(i, 10) = rsshowsales.Fields(7)
       If rsshowsales.Fields(8) = "Add K.S.T" Or rsshowsales.Fields(8) = "Add C.S.T" Then
          .TextMatrix(i, 11) = Mid(rsshowsales.Fields(8), 5, Len(rsshowsales.Fields(8)) - 4)
         .TextMatrix(i, 11) = rsshowsales.Fields(8)
       End If
    .MergeCells = flexMergeFree
    .MergeCol(0) = True
    .MergeCol(1) = True
    .MergeCol(2) = True
    .MergeCol(3) = True
    .MergeCol(4) = True
    .MergeCol(5) = True
    .MergeCol(6) = True
    .MergeCol(7) = True
    .MergeCol(8) = True
    .MergeCol(9) = True
    .MergeCol(11) = True
  End With
End Sub
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

LVL 70

Expert Comment

by:Éric Moreau
ID: 6985040
any progress?
LVL 70

Expert Comment

by:Éric Moreau
ID: 7060638
This question appears to be abandoned. A question regarding it will be left in the Community Support
area; if you have any comment about the question, please leave it here.

Unless there is objection or further activity, one of the moderators will be asked to accept the comment
of <emoreau>.

The link to the Community Support area is:


Expert Comment

ID: 7065779
Thanks, emoreau  for your help here.

I have finalized this question, and will monitor it for comments.

Moondancer - EE Moderator

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question