Solved

MSHFlexgrid problem with decimal values

Posted on 2002-04-12
6
291 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 70

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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6985040
any progress?
0
 
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:
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

776 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