Click here to Skip to main content
15,611,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an Access database of movies. I am creating a Windows Form Application. All the columns and rows show in the dataGridView on Form2. On Form1 there is a listBox that shows only the movie name. There is also a button on Form1. I want to select a movie name from the listBox and click the button and Form2 should pop up(which it does)and the record(row) for that movie should be selected in the dataGridView(which it doesn't) so I do not have to scroll through 800+ movies listed to find it.

Any thoughts?


1 solution

Look at DataGridView.Rows[index].Selected property: MSDN[^].

To make sure a row is scrolled into the display, set the DataGridView.CurrentCell property: MSDN[^]
Share this answer
Dirk Higbee 23-Jun-12 13:34pm    
Thank you, I searched MSDN yesterday for a long time and could not find that. I found lots of other samples that did not quite work for what I am doing. I knew it was there somewhere.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

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