C
Christian Westerlund
Hi!
I have a problem in my application where I have a datagrid.
the datasource is a datatable which I update every 6:th second.
foreach( Sobject s in sArrayList){
foreach( SSObject so in Sobject.array){
dT.Rows[x] =
(Myobject)so).T.Current;
}
}
I get an
"An unhandled exception of type 'System.NullReferenceException' occurred
in System.Data.dll"
when I scroll the datagrid down and upp for a minute or something like that.
The code jumps to:
static void Main()
{
Application.Run(new FrmMyApp()); }
If I take away the dT.Rows[x] row I don't get an exception.
If I set dT.Rows[x] = "1"
I don't get any exceptions.
If I replace the dT.Rows row with this:
float t = (Myobject)so).T.Current;
I don't get an exception.
I only get an exception when I combine them.
I have added this to my code but it doesn't seem to help:
dT.BeginLoadData();
lock( sArrayList.SyncRoot){
my code
}
dT.EndLoadData();
I would appreciate every help I could get on this.
/Christian
I have a problem in my application where I have a datagrid.
the datasource is a datatable which I update every 6:th second.
foreach( Sobject s in sArrayList){
foreach( SSObject so in Sobject.array){
dT.Rows[x] =
(Myobject)so).T.Current;
}
}
I get an
"An unhandled exception of type 'System.NullReferenceException' occurred
in System.Data.dll"
when I scroll the datagrid down and upp for a minute or something like that.
The code jumps to:
static void Main()
{
Application.Run(new FrmMyApp()); }
If I take away the dT.Rows[x] row I don't get an exception.
If I set dT.Rows[x] = "1"
I don't get any exceptions.
If I replace the dT.Rows row with this:
float t = (Myobject)so).T.Current;
I don't get an exception.
I only get an exception when I combine them.
I have added this to my code but it doesn't seem to help:
dT.BeginLoadData();
lock( sArrayList.SyncRoot){
my code
}
dT.EndLoadData();
I would appreciate every help I could get on this.
/Christian