Select rows in a DatGridView
Date: 01/24/08
(C Sharp) Keywords: database
Maybe I'm just blind, but...
I have a DataGridView
on a form with MultiSelect = false
and SelectionMode = DataGridViewSelectionMode.FullRowSelect
displaying data from a table in a database. My idea is, that a row is automatically selected, if a user enters the key value in a dialog. Not filtering, just selecting. The Rows
property provides a collection, and I can set the Selected
property of the current DataGridViewRow
element to true. But the only way I see to find the correct row is to iterate over all items, until I find the requested row.
Does someone have an idea for a simpler way?
Source: http://community.livejournal.com/csharp/91207.html