?
Solved

VB6 - Delete first Chars from MSFlexgrid if

Posted on 2013-01-26
7
Medium Priority
?
477 Views
Last Modified: 2013-01-26
Hello all

I'm trying to remove the 2 first characters form column 21 it the value in the cell start with RL.

Ex: If the value = RL123456, it will remove the RL and just leave 123456.

How can i do that?

Thanks again

        For grid_cust = 1 To MSHFlexGrid2.Rows - 1
        If Left(MSHFlexGrid2.TextMatrix(grid_cust, 21), 1, 2) = "RL" Then
            Left(MSHFlexGrid2.TextMatrix(grid_cust, 21), 1, 2) = ""
        End If
    Next grid_cust

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
  • 5
  • 2
7 Comments
 
LVL 49

Accepted Solution

by:
Martin Liss earned 2000 total points
ID: 38823276
MSHFlexGrid2.TextMatrix(grid_cust, 21) = Mid(MSHFlexGrid2.TextMatrix(grid_cust, 21),3)
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 38823279
That would replace line 3.
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 38823288
Hi MartinLiss

It only work if i do this:
If Left(MSHFlexGrid2.TextMatrix(grid_cust, 21), 1) = "R" Then

But not this:
If Left(MSHFlexGrid2.TextMatrix(grid_cust, 21), 1, 2) = "RL" Then

It gives me an error: incorrect number of arguments

Do you know why?


    For grid_cust = 1 To MSHFlexGrid2.Rows - 1
        If Left(MSHFlexGrid2.TextMatrix(grid_cust, 21), 1) = "R" Then
            MSHFlexGrid2.TextMatrix(grid_cust, 21) = Mid(MSHFlexGrid2.TextMatrix(grid_cust, 21), 3)
        End If
    Next grid_cust

Open in new window

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 49

Expert Comment

by:Martin Liss
ID: 38823294
textmatrix takes just two arguments

TextMatrix(rowindex, colindex)
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 38823300
So I think it should be the following assuming that grid_cust contains the row you want and 21 is the column

If Left(MSHFlexGrid2.TextMatrix(grid_cust, 21),2) = "RL" Then
0
 
LVL 11

Author Closing Comment

by:Wilder1626
ID: 38823311
Many thanks again

this is working great
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 38823324
You're welcome and I'm glad I was able to help.

Select the 'About Me' tab in my profile and you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2012
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

762 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