Solved

MSHFlexgrid problem with decimal values

Posted on 2002-04-12
6
288 Views
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.

Thanks
0
Comment
Question by:asimoes
  • 3
  • 2
6 Comments
 
LVL 69

Accepted Solution

by:
É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")
      Next
   Next
End With
0
 
LVL 1

Expert Comment

by:harsh008_k
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
0
 
LVL 1

Expert Comment

by:harsh008_k
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)
       Else
         .TextMatrix(i, 11) = rsshowsales.Fields(8)
       End If
        rsshowsales.MoveNext
     Next
    .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
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 69

Expert Comment

by:Éric Moreau
ID: 6985040
any progress?
0
 
LVL 69

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:
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt

DO NOT ACCEPT THIS COMMENT AS AN ANSWER.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 7065779
Thanks, emoreau  for your help here.

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

Moondancer - EE Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

919 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now