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
Solved

Help with highlighting rows based on identical values in multiple columns

Posted on 2016-11-17
1
38 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
1 Comment
 

Accepted Solution

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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

808 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