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
  • 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

828 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