I have this code that gets the count of selected rows ok but I want the string of whats shown on the attached as opposed to the index number of the row. not sure how to do that.
[code][code] Private Sub PanelLinkShort_Click(sender As Object, e As EventArgs) Handles PanelLinkShort.Click Dim selectedRowCount As Integer = DataGridViewStringsBulk.Rows.GetRowCount(DataGridViewElementStates.Selected) Dim x As String If selectedRowCount > 0 Then Dim i As Integer For i = 0 To selectedRowCount - 1 'get rows x = DataGridViewStringsBulk.SelectedRows(i).Index.ToString() Next i MessageBox.Show("Finished") End If End Sub
what do you mean? I have copied the name of your control from your code so it should be good? Where have you placed the new line of code? Inside your loop I hope! What is the error message that you get?
PeterBaileyUk
ASKER
it says it cannot be indexed because datagridviewrow has no default property
If selectedRowCount > 0 Then Dim i As Integer For i = 0 To selectedRowCount - 1 'get rows x = DataGridViewStringsBulk.SelectedRows(i)("Strshort").Value Next i MessageBox.Show("Finished") End If