RowChanged w/ DataRowState.Added still not working...

M

Mike Edenfield

I'm still having problems with the RowChanged event on the DataTable. I
need to find an event which runs after a new DataRow has been added to
the DataTable's Rows[] collection. Clearly, RowChanged() is not that
event, since the "e.Row" event argument is not in it's own DataTable's
Rows[] collection.

The following code demonstrates my problem:

private void RowChanged(object sender, DataRowChangeEventArgs e)
{
MyDataSet.MyRow row = e.Row as MyDataSet.MyRow;
DataRow[] rows = e.Row.Table.Select("ID = " + row.ID);
if ( rows.Length == 0 ) MessageBox.Show("Where's my new row?");
}

What am I missing?

--Mike
 
Y

yonggangwang

Hi:
Add this code after the form load
this.MyDataSet.Myrow.RowChanging +=new
DataRowChangeEventHandler(RowChanged);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top