UserAddedRow event in DataView

  • Thread starter Thread starter vitagoni
  • Start date Start date
V

vitagoni

I'm doing next:
private void maindataView_UserAddedRow(object sender,
DataGridViewRowEventArgs e)
{
DataRow[] rows = maxmoneyDataSet.servicedata.Select();
int sequence1 = (int)rows[0].ItemArray.GetValue(0);
string code = Formats.FormatCode(sequence1);

e.Row.Cells[0].Value = code;
}

But the code value is added to next row, not to the added row, do you know
why?


Thanks
 
Of course I can do like that:
private void maindataView_UserAddedRow(object sender,
DataGridViewRowEventArgs e)
{
DataRow[] rows = maxmoneyDataSet.servicedata.Select();
int sequence1 = (int)rows[0].ItemArray.GetValue(0);
string code = Formats.FormatCode(sequence1);

int index = e.Row.Index;
maindataView.Rows[index - 1].Cells[0].Value = code;

}

but, I suppose it should work for received row.

(((
 
Back
Top