c# - Index out of range exception in datagridview when header is selected -
Text after "div class =" itemprop = "text">
I think that for sorting or for any reason I get a follow-up error on the following line when I click on a title A DataGridView is the code ....
The reason for our exception is the argument (the index was out of bounds. Should be less than the size of the non-negative and the collection. <> I do not know why I am getting this particular error here. When RowIndex property returns -1, the cell is either a column header or a line of cells is shared. So you have to handle E.Roindex == -1 when you do yo event Private Zero firearmView_CellClick (Object Sender, DataGridViewCellEventArgs E) {Pre // I get the error above if line above. If (firearmView.Rows [e.RowIndex] .IsNewRow) {selectedFirearmPictureBox.Image = Image. FromFile (firearmView.Rows [e.RowIndex] .cs [12] .Value.ToString (), true);}}
(... index .... not negative Not Received)
Private Zero firearmView_CellClick (Object Sender, DataGridViewCellEventArgs e) {if (e.RowIndex == -1) Return; If {selectedFirearmPictureBox.Image = Image.FromFile (firearmView.Rows [e.RowIndex] .cs [12] .Value.ToString (), true) (firearmView.Rows [e.RowIndex] .IsNewRow!); }}
Comments
Post a Comment