Solved

Help with highlighting rows based on identical values in multiple columns

Posted on 2016-11-17
1
26 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now