• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 228
  • Last Modified:

VB6 - Delete row if specific cell in Grid have a specific color

Hi.

I would like to know how i can delete all rows of my MSHFlexgrid1 that are not with a back color: &H80FF& in column 1.

How can i do that please?

Thanks

  Dim i As Long
    For i = MSHFlexGrid1.Rows - 1 To 1 Step -1
    
        If MSHFlexGrid1.TextMatrix(i, 1) .CellBackColor <> &H80FF& Then
        MSHFlexGrid1.RemoveItem i
        Else
            
        End If
    Next

Open in new window

0
Wilder1626
Asked:
Wilder1626
  • 3
1 Solution
 
Martin LissRetired ProgrammerCommented:
What happens when you run that code? Does it compile?
0
 
Martin LissRetired ProgrammerCommented:
Try this.

Dim i As Long
    MSHFlexGrid1.Col = 1
    For i = MSHFlexGrid1.Rows - 1 To 1 Step -1
    
        MSHFlexGrid1.Row = i
        If MSHFlexGrid1.CellBackColor <> &H80FF& Then
            MSHFlexGrid1.RemoveItem i
        Else
            
        End If
    Next

Open in new window

0
 
Wilder1626Author Commented:
This is perfect.

Thanks again for your help.
0
 
Martin LissRetired ProgrammerCommented:
You're welcome.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now