How to change all selected rows in DataGridView - VB.NEt
Ask a question. I am trying to write a small piece of code in Visual Studio (VB.net) that will change the value of a specific database field for all highlightetd rows. So I launch my form which displays some data from the database. Then I select multiple lines (by holding Ctrl and clicking). Then I click a button that causes the value to change for all selected rows (only). Let's say I want to change the value of the Name column for all of them.
Hope this makes sense. Thank you! Damo
0
a source to share
1 answer
The DataGridView.SelectedRows property contains a collection of all rows that the user has selected. You can loop through this collection and do what you want with each line.
See this article for more information and sample code.
+2
a source to share