• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 378
  • Last Modified:

Use vb.net grid control with ability to check rows and loop through

Hi everyone,  I want to use the grid control in vb.net.  It will be bound to a dataset.  I need a way to click on multiple rows perhaps selecting a check box.  

When a user clicks a button on the form, I will loop through the selected rows and execute some code.

Can anyone help!
0
jwebster77
Asked:
jwebster77
  • 2
2 Solutions
 
CodeCruiserCommented:
Set the MultiSelect property of grid to true, then use CTRL or SHIFT keys and click to select multiple rows. On button click, loop through the SelectedRows property of the grid.
0
 
jwebster77Author Commented:
Do you have any code example for looping?
0
 
CodeCruiserCommented:
Its a simple loop

For i As Integer = 0 to grid.SelectedRows.Count-1
    Msgbox grid.SelectedRows(i).Cells(0).Value
Next
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now