In my application, I use a DataGridView to display a list. When the user selects an entry in a datagridview, he must display the details in another panel. For selection, I was asked to use the DataGridView1_SelectionChanged event.
The DataGridView should contain only one column, but the information display may contain more information about the selected record (we can get all the details from the database by querying with the selected value of the main key).
Tell me if I can get the datakey (primary key) of the selected DataGridView record. Will the DataGridView bind based on the Primary Key
Edit
I implemented DataGridView1.Columns ["ID"]. Visible = false. He worked well. For selection, I added the DataGridView1_SelectionChanged event.
But the DataGridView1_SelectionChanged event fires several times.
source
share