?
Solved

Help with highlighting rows based on identical values in multiple columns

Posted on 2016-11-17
1
Medium Priority
?
45 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

752 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