views:

467

answers:

1

Hi all,

Begginer's question. I'm trying to write small piece of code in Visual Studio (VB.net) that will change value of a particular field of the database for all highlightetd rows. So, I'm running my form, which displays some data from the datatabse. I then highlight some rows (holding Ctrl and clicking). Next I click a button that will trigger a value change for all the highlighted rows (only). Say, I want to change the "Name" column's value for all of them.

Hope this makes sense. Thanks! Damo

+2  A: 

The DataGridView.SelectedRows property contains a collection of all of the rows that the user has selected. You can spin through this collection and do what you wish with each row.

See this article for more information and example code.

Robert Harvey