Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB6 - Delete first Chars from MSFlexgrid if

Posted on 2013-01-26
7
Medium Priority
?
482 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
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!

 
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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

636 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