Изолированный экземпляр indexoutofrangeexception: индекс не имеет ошибки значения.
I have an app that lists warranty issues in a datagrid view. Users then double click anywhere within the row to open a new form with the details of the issue. My development machine is windows 7, VS 2015. It works on this machine fine. A colleague has a windows 10 laptop - it works fine on there. I have a windows 10 surface tablet - and here's the isolated case. I get the index has no value error when I double click on the datagrid view. The odd thing is, it's not on every row -that this happens. Code below of the click event. The commented section is the alternate method I've tried, both fail on the surface but work on the debug machine and other windows 10 machines. So it's been very difficult to find as I can't generate a call stack since I don't get the error debugging. All I am trying to do is find out what row the user clicked on, find a value in column 2 (column 1 is a hidden index) ... then open the detail form and filter the datasource to the column value which happens to be an incident number. I pass it via the value via variable "v" I have exhausted my search on this - as it works on most machines. but we have several people at my work that use surfaces - and it fails on surfaces. no idea why. any suggestions?
Что я уже пробовал:
Public Sub dgvIssues_CellMouseDoubleClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles dgvIssues.CellMouseDoubleClick If dgvIssues.Rows.Count > 0 Then Try If e.RowIndex >= 0 AndAlso e.ColumnIndex >= 0 Then v = dgvIssues.Rows(e.RowIndex).Cells(1).Value.ToString Debug.Print("v = " & v) End If 'For x As Integer = 0 To Me.dgvIssues.SelectedCells.Count - 1 ' Dim i As Integer ' i = dgvIssues.SelectedCells(x).RowIndex ' v = dgvIssues.Rows(i).Cells(1).Value.ToString ' Debug.Print(v) 'Next Catch f As Exception MessageBox.Show(f.Message) End Try frmIssue.Show() End If