I am facing a problem,
I have pulled some records in DataGridView from database. Now I want that when I select some rows from DataGridView and click on command button, ID's of all selected rows should be displayed through message box.
By using followng code I am able to display ID but problem is, "When I select multiple rows and click on Button, msgbox shows only the ID of later selected row, kindly help me.
I'm using Visual Basic for Windows Form.
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click For i = 1 To DataGridViewIU68E.SelectedRows.Count Dim ID As Integer = DirectCast(DataGridViewIU68E.SelectedRows(0).Cells("EvaluationIDDataGridViewTextBoxColumn").Value, Integer) MsgBox(ID) Next End Sub