Determining sorted order, in DataGridView cell Paint method.

I have a DataGridView which displays a object I've derived from DataSet.  In my object, I have an ArrayList if items, I've used to create DataRows in a DataTable, which is then displayed by the DataGridView.  I have also derived a class from DataGridViewTextBoxCell, to handle drawing my cells.  

Here's the problem.  The background color of a row, depends on a property of the an item in my original ArrayList of items.  Before sorting the rowIndex I get in the DataGridViewTextBoxCell Paint corresponds to the index into my ArrayList of items.  After the user sorts the table, it does not.  How do I map between these?   What is the easiest way?

Thanks,
Gerry
LVL 1
gerry99Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
What is the condition to change the background color?

Bob
gerry99Author Commented:
I've created my own workaround.  What I do is read the string contents of a cell that I can use as a key, and access my orignal row items with that key.  I could not find any way to do this with DataGridView or DataGrid for that matter.

I don't need an answer anymore.
Thanks,
Bob LearnedCommented:
That's too bad, because I had a different direction that you might take that doesn't depend on the paint event.

Bob

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gerry99Author Commented:
If you've got a solution you can have the points, I'd still be interested to know what it is.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.