Wednesday, 15 September 2010

winforms - c# datagridview row indeces validation -


If I double-click on a row header cell in my gridview, I get an indicative parameter error. I tried fixing my double click event with my Row index statement, but is there any other place I want to do?

  Private Zero DGV1_CellDoubleClick (Object Sender, DataGridViewCellEventArgsE) {try {if ((E. Column Index & gt; 0)) {EditUser eu = new EditUser (); Eu.UserId = DGV1.Rows [e.RowIndex]. Game [1] .Value.ToString (); FormFunctions.OpenMdiDataForm (Program.GetMainMdiParent (), EU); } If (E. randex == 0 || E.RO index == -1) {return; }} Catch (Exceptional Former) {Message Box. Show ("error \ n" + pre. Message, "error", message box button. OK, message box icon. Error); }}  

Your verification argument is not implemented in the desired order Change to:

  Try {if (e.ColumnIndex & gt; 0 & amp; amp; e.RowIndex & gt; 0) {EditUser eu = new EditUser (); Eu.UserId = DGV1.Rows [e.RowIndex]. Game [1] .Value.ToString (); FormFunctions.OpenMdiDataForm (Program.GetMainMdiParent (), EU); }} Catch (Exceptional Former) {Message Box. Show ("error \ n" + pre. Message, "error", message box button. OK, message box icon. Error); }  

No comments:

Post a Comment