Solved

Help with highlighting rows based on identical values in multiple columns

Posted on 2016-11-17
1
41 Views
Last Modified: 2016-11-25
Hi,

I am using the code below to highlight records where selected column (i.e. yx = column1)have identical values in two or more records. How do I modify it to the the same when I select multiple columns? For example If I select two columns (i.e. yx = column1, column2) from a list box I need to highlight records where values in both columns are identical in two or more records. This is third party Grid Control from ComponentOne.

 Dim cc As Integer = 0
        e.CellStyle.BackColor = DefaultBackColor
        e.CellStyle.ForeColor = DefaultForeColor
        Try
            Dim checkCols As String = yx

            If checkCols.Count > 0 Then

                Dim tempRow = C1Screen1.FocusedSplit.Rows.OfType(Of C1.Win.C1TrueDBGrid.BaseGrid.ViewRow).ToList()
                Dim flag As Boolean = False
                Dim origItem As String = ""
                For Each item As String In checkCols.Split(","c)
                    origItem = origItem + C1Screen1(e.Row, item.Trim("'"c)).ToString()
                Next
                For j As Integer = 0 To tempRow.Count - 1
                    Dim tempItem As String = ""
                    For Each item As String In checkCols.Split(","c)
                        tempItem = tempItem + C1Screen1(j, item.Trim("'"c)).ToString()
                    Next
                    If Not flag AndAlso e.Row <> j Then
                        If origItem = tempItem Then
                            flag = True
                        End If
                    End If
                Next
                e.CellStyle.BackColor = DefaultBackColor
                e.CellStyle.ForeColor = DefaultForeColor
                If flag Then
                    e.CellStyle.BackColor = Color.DarkGreen
                    e.CellStyle.ForeColor = Color.White
                    cc = 1
                    Exit Sub
                Else
                    e.CellStyle.BackColor = DefaultBackColor
                    e.CellStyle.ForeColor = DefaultForeColor
                    cc = 0
                End If
            End If
            '   C1Screen1.Refresh()
            If cc <> 1 Then
                C1Screen1.Refresh()
                ' MsgBox("No Matches Found")
                'Exit Sub
            End If
        Catch
            ccc = 1
            Exit Sub

        End Try

Thanks,

Victor
0
Comment
Question by:vcharles
[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
1 Comment
 

Accepted Solution

by:
vcharles earned 0 total points
ID: 41901353
Please close this question.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Create a Dropdown list with sub group 10 43
Web page design problem 3 41
Subtract dates in vb.net 6 33
VB.NET Parsing UDP Bytes 15 36
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

732 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