Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Change "," with "." in MSHFlexGrid1 vb6

Posted on 2011-02-24
2
Medium Priority
?
698 Views
Last Modified: 2012-05-11
Hello all,

In my code bellow, i apply a format to be "0.00". That, it work.

But what i want to add, it's this:

In the same column, search for comma ",", it there is one, put the cell in orange, and change it to a dot ".".

That, for all the MSHFlexGrid1.

How can i do that please?

Thanks again for your help.

Private Sub Command6_Click()
Dim i As Long

 
For i = 1 To MSHFlexGrid1.Rows - 1
        
        'Grids are 0 based so 0 means col1, 1 means col2, 3 means col2 and so on
        If MSHFlexGrid1.TextMatrix(i, 3) <> "" Then

            
            'Format
            
            MSHFlexGrid1.TextMatrix(i, 18) = Format(MSHFlexGrid1.TextMatrix(i, 18), "0.00")
            
            MSHFlexGrid1.TextMatrix(i, 19) = Format(MSHFlexGrid1.TextMatrix(i, 19), "0.00")
            
            MSHFlexGrid1.TextMatrix(i, 20) = Format(MSHFlexGrid1.TextMatrix(i, 20), "0.00")
            
            MSHFlexGrid1.TextMatrix(i, 21) = Format(MSHFlexGrid1.TextMatrix(i, 21), "0.00")
            
            MSHFlexGrid1.TextMatrix(i, 43) = Format(MSHFlexGrid1.TextMatrix(i, 43), "0.00")
            
            MSHFlexGrid1.TextMatrix(i, 46) = Format(MSHFlexGrid1.TextMatrix(i, 46), "0.00")
            
            MSHFlexGrid1.TextMatrix(i, 49) = Format(MSHFlexGrid1.TextMatrix(i, 49), "0.00")
            
            
        Else
            'break out of loop
            Exit For
        End If
    Next i
End Sub

Open in new window

0
Comment
Question by:Wilder1626
[X]
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
2 Comments
 
LVL 14

Accepted Solution

by:
VBClassicGuy earned 2000 total points
ID: 34969837
In your

'Format

section, use:

txt = MSHFlexGrid1.TextMatrix(i, 3)

If Instr(txt,",") Then
   txt = Replace(txt, ",", ".")
   MSHFlexGrid1.TextMatrix(i, 3) = txt
   MSHFlexGrid1.Row = i
   MSHFlexGrid1.Col = 3
   MSHFlexGrid1.CellBackColor = &H80FF&
End If
0
 
LVL 11

Author Closing Comment

by:Wilder1626
ID: 34969935
Thanks for your help.

This is perfect.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…
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…
Suggested Courses

722 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