Click here to Skip to main content
15,867,330 members

How to compare cell values of datagridview with each other

vishal deb asked:

Open original thread
If I have a datagridview of say 7 Rows and 27 Columns and if I need to compare the values of cells with another cells how to do it?
Detail:
I need to compare 1st Row cell value with rest of the 6 rows cell values, same thing repeats for 2nd Row for rest 5 row, again same comparison needed for 3rd row with rest 4 rows. Basically It is row wise comparison
ROW1-> 2 2 2 4 4 6 6 8 8 8 7 7
ROW2-> 1 1 1 7 7 7 6 9 9 9 7 7
ROW3-> 1 1 3 3 3 3 5 5 5 0 0 0
ROW4-> 2 2 2 0 0 0 0 1 1 1 7 7
ROW5-> 0 0 0 3 3 3 4 4 4 8 8 8

Now I want to color those Cell whose values are repeating. Any idea will be a great help for me.
Tags: C# (C# 3.0), DataGridView

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900