troubleshooting Question

C# DataGrid - Set the selected row in code

Avatar of 1500orion
1500orion asked on
C#
2 Comments1 Solution2795 ViewsLast Modified:
I would like to set the selected row for a DataGrid in code.  I have some DataTable's default views bound to DataGrid's.  I am comparing both DataTable's for differences cell by cell (same table structure) and want to update the DataGrid's cell background color where the difference occurred.  I have a unique key in the data.  So I want to set the selected row in code where Col A is equal to a specified value.  I already have code that will take the selected row and index Col so I can hit the cell.  But I need to pro-grammatically set the selected row for the DataGrid in code where Col A is equal to a dynamic value specified in code. Everything I am seeing is how to do this on an event but I need to be able to do this in code without an event being fired on the DataGrid.  I am not allowing sorting on the DataGrid so re-ordering wouldn't pose any issues.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros