I am trying to figure out how to get the events for a table to NOT fire.
Please take a look at the example code below. No matter how I do it the
event still fire. What am I doing wrong?

Please someone respond, this is killing an arch. design in a application I
am working on.

DataSet ds = new DataSet();
//FIRST TRY
ds.Tables.Add(new DataTable());
ds.Tables[0].RowChanged +=new DataRowChangeEventHandler(Form1_RowChanged);
ds.Tables[0].BeginLoadData();
DataRow dr = ds.Tables[0].NewRow();
ds.Tables[0].Rows.Add(dr);
ds.AcceptChanges();
ds.Tables[0].EndLoadData();
ds.Clear(); //CLEAR
//START SECOND TRY
ds.Tables[0].Clear();
ds.Tables[0].BeginLoadData();
dr = ds.Tables[0].NewRow();
ds.Tables[0].LoadDataRow(dr.ItemArray,true);
ds.Tables[0].EndLoadData();

Re: BeginLoadData EndLoadData LoadDataRow, Events still fire by Miha

Miha
Thu Sep 30 01:31:31 CDT 2004

Hi Chris,


"Chris Alm" <none@none.com> wrote in message
news:gOJ6d.256545$yk.43781@news.easynews.com...
>I am trying to figure out how to get the events for a table to NOT fire.
> Please take a look at the example code below. No matter how I do it the
> event still fire. What am I doing wrong?

The BeginLoadData description is a bit deceptive. It doesn't turn off events
(it does stop indexing, constraints and calculated columns refreshing).
Why don't you unlink events by yourself and after fill relink them (I don't
think that there is any other option).

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com