DataSet connected to DataGrid crashes my app?

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi,

I have a strongly typed dataset that I put data into that I receive
asynchronously via a socket connection.

The app works fine until I set dataGrid.DataSource = myDataSet. The app
crashes will a NullException inside Application.Run().

Could I be adding data to the DataSet incorrectly? I call BeginLoad and
EndLoad before and after I add a row to the dataset.

Any ideas?

Thanks,
John
 
Hi John,

I'm not quite sure on how this happened. Can you paste a short code snippet
for me to reproduce the problem? So that I can deliver my assistance more
quickly.

If you are retrieving data asynchronously, the result dataset is in another
thread. Have you get the result dataset in a proper way?

Would you also give me some error messages you received? Did you mean a
NullReferenceException is thrown in your last post?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| From: "John" <[email protected]>
| Subject: DataSet connected to DataGrid crashes my app?
| Date: Wed, 8 Oct 2003 17:21:56 -0400
| Lines: 17
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.adonet
| NNTP-Posting-Host: cosiapat1.net.americas.agilent.com 192.25.240.225
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:63244
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| Hi,
|
| I have a strongly typed dataset that I put data into that I receive
| asynchronously via a socket connection.
|
| The app works fine until I set dataGrid.DataSource = myDataSet. The app
| crashes will a NullException inside Application.Run().
|
| Could I be adding data to the DataSet incorrectly? I call BeginLoad and
| EndLoad before and after I add a row to the dataset.
|
| Any ideas?
|
| Thanks,
| John
|
|
|
 
Hi John,

I'm not quite sure on how this happened. Can you paste a short code snippet
for me to reproduce the problem? So that I can deliver my assistance more
quickly.

Good idea. I'll see if I can build a small app that demonstrates the
problem.
If you are retrieving data asynchronously, the result dataset is in another
thread. Have you get the result dataset in a proper way?

I think that this is the problem.

This is how I add a row:

messages.Grant.BeginLoadData();
messages.Grant.AddGrantRow(DateTime.Now, id, channel);
messages.Grant.EndLoadData();

I'm almost certainly calling AddGrantRow() from a thread that did not
create the GUI and did not create the dataset. Is there something
special I have to do (some sort of invoke?) if I'm adding data to a
dataset from another thread?
Would you also give me some error messages you received? Did you mean a
NullReferenceException is thrown in your last post?

I'll run the app again and let you know.

Thank you very much for your help!

John
 
Hi John,

In a multi-threaded application, you have to do some synchronization on
data to prevent two threads access one data at the same time. This might
also cause you application to crash. Here are some articles about
synchronizing data:

http://msdn.microsoft.com/msdnmag/issues/03/01/NET/

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconmanagedthreadingsupport.asp

If it still doesn't work, I'll be glad to see your code snippet. :)

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| From: (e-mail address removed) (John)
| Newsgroups: microsoft.public.dotnet.framework.adonet
| Subject: Re: DataSet connected to DataGrid crashes my app?
| Date: 9 Oct 2003 09:40:28 -0700
| Organization: http://groups.google.com
| Lines: 33
| Message-ID: <[email protected]>
| References: <[email protected]>
<[email protected]>
| NNTP-Posting-Host: 192.25.240.225
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1065717628 24520 127.0.0.1 (9 Oct 2003
16:40:28 GMT)
| X-Complaints-To: (e-mail address removed)
| NNTP-Posting-Date: Thu, 9 Oct 2003 16:40:28 +0000 (UTC)
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!news-out.cwix.com!newsfeed.cwix.co
m!news.maxwell.syr.edu!postnews1.google.com!not-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:63306
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| (e-mail address removed) (Kevin Yu [MSFT]) wrote in message
| > Hi John,
| >
| > I'm not quite sure on how this happened. Can you paste a short code
snippet
| > for me to reproduce the problem? So that I can deliver my assistance
more
| > quickly.
|
| Good idea. I'll see if I can build a small app that demonstrates the
| problem.
|
| > If you are retrieving data asynchronously, the result dataset is in
another
| > thread. Have you get the result dataset in a proper way?
|
| I think that this is the problem.
|
| This is how I add a row:
|
| messages.Grant.BeginLoadData();
| messages.Grant.AddGrantRow(DateTime.Now, id, channel);
| messages.Grant.EndLoadData();
|
| I'm almost certainly calling AddGrantRow() from a thread that did not
| create the GUI and did not create the dataset. Is there something
| special I have to do (some sort of invoke?) if I'm adding data to a
| dataset from another thread?
| > Would you also give me some error messages you received? Did you mean a
| > NullReferenceException is thrown in your last post?
|
| I'll run the app again and let you know.
|
| Thank you very much for your help!
|
| John
|
 
Kevin,

Thanks for your posting.

I will study the links you've provided. I read the documentation
associated with the DataSet and it appears that I only need to
synchronize writes to the dataset, not reads.

I write to my dataset in only one place. At that place I've put a
"lock" around the adding of the row:

lock (messages)
{
messages.Grant.AddGrantRow(DateTime.Now, id, channel);
}

However, I still get a crash inside Application.Run(). The crash is:


An unhandled exception of type 'System.NullReferenceException'
occurred in System.windows.forms.dll
Additional information: Object reference not set to an instance of an
object.

Is putting a lock around messages the proper way to synchronize access
to the DataSet?

Thanks,
John


Hi John,

In a multi-threaded application, you have to do some synchronization on
data to prevent two threads access one data at the same time. This might
also cause you application to crash. Here are some articles about
synchronizing data:

http://msdn.microsoft.com/msdnmag/issues/03/01/NET/

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconmanagedthreadingsupport.asp

If it still doesn't work, I'll be glad to see your code snippet. :)

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| From: (e-mail address removed) (John)
| Newsgroups: microsoft.public.dotnet.framework.adonet
| Subject: Re: DataSet connected to DataGrid crashes my app?
| Date: 9 Oct 2003 09:40:28 -0700
| Organization: http://groups.google.com
| Lines: 33
| Message-ID: <[email protected]>
| References: <[email protected]>
<[email protected]>
| NNTP-Posting-Host: 192.25.240.225
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1065717628 24520 127.0.0.1 (9 Oct 2003
16:40:28 GMT)
| X-Complaints-To: (e-mail address removed)
| NNTP-Posting-Date: Thu, 9 Oct 2003 16:40:28 +0000 (UTC)
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!news-out.cwix.com!newsfeed.cwix.co
m!news.maxwell.syr.edu!postnews1.google.com!not-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:63306
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| (e-mail address removed) (Kevin Yu [MSFT]) wrote in message
| > Hi John,
| >
| > I'm not quite sure on how this happened. Can you paste a short code
snippet
| > for me to reproduce the problem? So that I can deliver my assistance
more
| > quickly.
|
| Good idea. I'll see if I can build a small app that demonstrates the
| problem.
|
| > If you are retrieving data asynchronously, the result dataset is in
another
| > thread. Have you get the result dataset in a proper way?
|
| I think that this is the problem.
|
| This is how I add a row:
|
| messages.Grant.BeginLoadData();
| messages.Grant.AddGrantRow(DateTime.Now, id, channel);
| messages.Grant.EndLoadData();
|
| I'm almost certainly calling AddGrantRow() from a thread that did not
| create the GUI and did not create the dataset. Is there something
| special I have to do (some sort of invoke?) if I'm adding data to a
| dataset from another thread?
| > Would you also give me some error messages you received? Did you mean a
| > NullReferenceException is thrown in your last post?
|
| I'll run the app again and let you know.
|
| Thank you very much for your help!
|
| John
|
 
Hi John,

Putting a lock around a variable is the proper way to synchronize access to
the data.

You keep getting a System.NullReferenceException. The exception is always
thrown when there is an attempt to dereference a null object reference. So,
please set a break point on the statement which throws this exception, and
try to see if any variables or parameters are pointing to a null reference,
or any reference are pointing to objects on another thread.

If all is correct, and you still get that exception, please package a small
project which can reproduce this issue and email it to me. I'm always glad
to help. Remove "online" from the email address above is my real email
address.

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| From: (e-mail address removed) (John)
| Newsgroups: microsoft.public.dotnet.framework.adonet
| Subject: Re: DataSet connected to DataGrid crashes my app?
| Date: 10 Oct 2003 10:31:25 -0700
| Organization: http://groups.google.com
| Lines: 114
| Message-ID: <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
<#[email protected]>
| NNTP-Posting-Host: 192.25.240.225
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1065807086 28001 127.0.0.1 (10 Oct 2003
17:31:26 GMT)
| X-Complaints-To: (e-mail address removed)
| NNTP-Posting-Date: Fri, 10 Oct 2003 17:31:26 +0000 (UTC)
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onlin
e.de!newsfeed.freenet.de!fu-berlin.de!postnews1.google.com!not-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:63383
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| Kevin,
|
| Thanks for your posting.
|
| I will study the links you've provided. I read the documentation
| associated with the DataSet and it appears that I only need to
| synchronize writes to the dataset, not reads.
|
| I write to my dataset in only one place. At that place I've put a
| "lock" around the adding of the row:
|
| lock (messages)
| {
| messages.Grant.AddGrantRow(DateTime.Now, id, channel);
| }
|
| However, I still get a crash inside Application.Run(). The crash is:
|
|
| An unhandled exception of type 'System.NullReferenceException'
| occurred in System.windows.forms.dll
| Additional information: Object reference not set to an instance of an
| object.
|
| Is putting a lock around messages the proper way to synchronize access
| to the DataSet?
|
| Thanks,
| John
|
|
| (e-mail address removed) (Kevin Yu [MSFT]) wrote in message
| > Hi John,
| >
| > In a multi-threaded application, you have to do some synchronization on
| > data to prevent two threads access one data at the same time. This
might
| > also cause you application to crash. Here are some articles about
| > synchronizing data:
| >
| > http://msdn.microsoft.com/msdnmag/issues/03/01/NET/
| >
| >
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
| > l/cpconmanagedthreadingsupport.asp
| >
| > If it still doesn't work, I'll be glad to see your code snippet. :)
| >
| > If anything is unclear, please feel free to reply to the post.
| >
| > Kevin Yu
| > =======
| > "This posting is provided "AS IS" with no warranties, and confers no
| > rights."
| >
| > --------------------
| > | From: (e-mail address removed) (John)
| > | Newsgroups: microsoft.public.dotnet.framework.adonet
| > | Subject: Re: DataSet connected to DataGrid crashes my app?
| > | Date: 9 Oct 2003 09:40:28 -0700
| > | Organization: http://groups.google.com
| > | Lines: 33
| > | Message-ID: <[email protected]>
| > | References: <[email protected]>
| > <[email protected]>
| > | NNTP-Posting-Host: 192.25.240.225
| > | Content-Type: text/plain; charset=ISO-8859-1
| > | Content-Transfer-Encoding: 8bit
| > | X-Trace: posting.google.com 1065717628 24520 127.0.0.1 (9 Oct 2003
| > 16:40:28 GMT)
| > | X-Complaints-To: (e-mail address removed)
| > | NNTP-Posting-Date: Thu, 9 Oct 2003 16:40:28 +0000 (UTC)
| > | Path:
| >
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!news-out.cwix.com!newsfeed.cwix.co
| > m!news.maxwell.syr.edu!postnews1.google.com!not-for-mail
| > | Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.adonet:63306
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
| > |
| > | (e-mail address removed) (Kevin Yu [MSFT]) wrote in message
| > | > | > Hi John,
| > | >
| > | > I'm not quite sure on how this happened. Can you paste a short code
| > snippet
| > | > for me to reproduce the problem? So that I can deliver my
assistance
| > more
| > | > quickly.
| > |
| > | Good idea. I'll see if I can build a small app that demonstrates the
| > | problem.
| > |
| > | > If you are retrieving data asynchronously, the result dataset is in
| > another
| > | > thread. Have you get the result dataset in a proper way?
| > |
| > | I think that this is the problem.
| > |
| > | This is how I add a row:
| > |
| > | messages.Grant.BeginLoadData();
| > | messages.Grant.AddGrantRow(DateTime.Now, id, channel);
| > | messages.Grant.EndLoadData();
| > |
| > | I'm almost certainly calling AddGrantRow() from a thread that did not
| > | create the GUI and did not create the dataset. Is there something
| > | special I have to do (some sort of invoke?) if I'm adding data to a
| > | dataset from another thread?
| > | > Would you also give me some error messages you received? Did you
mean a
| > | > NullReferenceException is thrown in your last post?
| > |
| > | I'll run the app again and let you know.
| > |
| > | Thank you very much for your help!
| > |
| > | John
| > |
|
 
If all is correct, and you still get that exception, please package a small
project which can reproduce this issue and email it to me. I'm always glad
to help. Remove "online" from the email address above is my real email
address.

Kevin,

I sent you some code earlier this week, but I haven't heard back from
you.

I think the problem is that I'm adding data to the DataSet from a
thread different than the thread that created the GUI.

How do I handle this?

Thanks,
John
 
Hi John,

Sorry for kept you waiting. I've checked your code and found that there is
some threading synchronizing problem in it.

In the main thread, the DataSet was bound to a DataGrid with
dataGrid.DataSource = myDataset. In another thread, it appends data to the
data source. This might be the cause of the problem. Because each time you
add a new row to the DataTable, the DataGrid will access the data source to
refresh the view in main thread. Since it's not thread safe, there might be
concurrency when both threads access the data source. If a thread is
accessing it exclusively, another thread might throw a
NullReferenceException.

In this case, my recommendation is to bind data after the data source is
generated, since I don't think you're going to add data in a dead loop. :-)

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| From: (e-mail address removed) (John)
| Newsgroups: microsoft.public.dotnet.framework.adonet
| Subject: Re: DataSet connected to DataGrid crashes my app?
| Date: 23 Oct 2003 12:46:08 -0700
| Organization: http://groups.google.com
| Lines: 17
| Message-ID: <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
<#[email protected]>
<[email protected]>
<[email protected]>
| NNTP-Posting-Host: 192.25.240.225
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1066938368 25969 127.0.0.1 (23 Oct 2003
19:46:08 GMT)
| X-Complaints-To: (e-mail address removed)
| NNTP-Posting-Date: Thu, 23 Oct 2003 19:46:08 +0000 (UTC)
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onlin
e.de!diablo.theplanet.net!news.maxwell.syr.edu!postnews1.google.com!not-for-
mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:64438
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| > If all is correct, and you still get that exception, please package a
small
| > project which can reproduce this issue and email it to me. I'm always
glad
| > to help. Remove "online" from the email address above is my real email
| > address.
|
| Kevin,
|
| I sent you some code earlier this week, but I haven't heard back from
| you.
|
| I think the problem is that I'm adding data to the DataSet from a
| thread different than the thread that created the GUI.
|
| How do I handle this?
|
| Thanks,
| John
|
 
In the main thread, the DataSet was bound to a DataGrid with
dataGrid.DataSource = myDataset. In another thread, it appends data to the
data source. This might be the cause of the problem. Because each time you
add a new row to the DataTable, the DataGrid will access the data source to
refresh the view in main thread. Since it's not thread safe, there might be
concurrency when both threads access the data source. If a thread is
accessing it exclusively, another thread might throw a
NullReferenceException.

I agree that the problem is related to the threads.
In this case, my recommendation is to bind data after the data source is
generated, since I don't think you're going to add data in a dead loop. :-)

Remember, I put together this simple demonstration, based on your
request, do demonstrate the problem.

In my real application I'm adding data to a DataSet from threads that
are spawned asynchronously. Therefore, it's impossible to delay the
association of the DataSet with the DataGrid.

There must be a better solution to this problem? There should be a
..invoke() delegate/method in DataSet that can be called to add data
from another thread.

Please help.

Thanks,
John
 
Hi John,

The common solution to this problem is let the second thread retrieve data
from the database and post it to the main thread. When the main thread gets
the data, let the main thread add it to the DataSet. Of course you have to
lock the DataSet when accessing it in both threads. Thus, only one thread
will access the DataSet when it is bound to a DataGrid.

Does this answer your question? If anything is unclear, please feel free to
reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| From: (e-mail address removed) (John)
| Newsgroups: microsoft.public.dotnet.framework.adonet
| Subject: Re: DataSet connected to DataGrid crashes my app?
| Date: 24 Oct 2003 05:29:09 -0700
| Organization: http://groups.google.com
| Lines: 30
| Message-ID: <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
<#[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| NNTP-Posting-Host: 192.25.240.225
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1066998549 433 127.0.0.1 (24 Oct 2003
12:29:09 GMT)
| X-Complaints-To: (e-mail address removed)
| NNTP-Posting-Date: Fri, 24 Oct 2003 12:29:09 +0000 (UTC)
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onlin
e.de!newsfeed.icl.net!newsfeed.fjserv.net!news.maxwell.syr.edu!postnews1.goo
gle.com!not-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:64479
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| (e-mail address removed) (Kevin Yu [MSFT]) wrote in message
| > In the main thread, the DataSet was bound to a DataGrid with
| > dataGrid.DataSource = myDataset. In another thread, it appends data to
the
| > data source. This might be the cause of the problem. Because each time
you
| > add a new row to the DataTable, the DataGrid will access the data
source to
| > refresh the view in main thread. Since it's not thread safe, there
might be
| > concurrency when both threads access the data source. If a thread is
| > accessing it exclusively, another thread might throw a
| > NullReferenceException.
|
| I agree that the problem is related to the threads.
|
| > In this case, my recommendation is to bind data after the data source
is
| > generated, since I don't think you're going to add data in a dead loop.
:-)
|
| Remember, I put together this simple demonstration, based on your
| request, do demonstrate the problem.
|
| In my real application I'm adding data to a DataSet from threads that
| are spawned asynchronously. Therefore, it's impossible to delay the
| association of the DataSet with the DataGrid.
|
| There must be a better solution to this problem? There should be a
| .invoke() delegate/method in DataSet that can be called to add data
| from another thread.
|
| Please help.
|
| Thanks,
| John
|
 
Hi John,

The common solution to this problem is let the second thread retrieve data
from the database and post it to the main thread. When the main thread gets
the data, let the main thread add it to the DataSet. Of course you have to
lock the DataSet when accessing it in both threads. Thus, only one thread
will access the DataSet when it is bound to a DataGrid.

Does this answer your question? If anything is unclear, please feel free to
reply to the post.
How about an example? I think there must be a better way.

What this means is that the DataSet is thread safe unless it's
attached to a DataGrid. Right?

Seems like there should be some sort of .Invoke method in this case?

John
 
Hi John,

Sorry that I cannot find so specific code for you. However, this is the
most common and safe way that I know.

What you supposed is nearly right, but we can only say that a method is
thread safe, because a resource is never safe if you use it in an unsafe
method. In this case, we say that databinding is not thread safe.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| From: (e-mail address removed) (John)
| Newsgroups: microsoft.public.dotnet.framework.adonet
| Subject: Re: DataSet connected to DataGrid crashes my app?
| Date: 26 Oct 2003 07:30:05 -0800
| Organization: http://groups.google.com
| Lines: 19
| Message-ID: <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
<#[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| NNTP-Posting-Host: 68.55.108.242
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1067182205 13758 127.0.0.1 (26 Oct 2003
15:30:05 GMT)
| X-Complaints-To: (e-mail address removed)
| NNTP-Posting-Date: Sun, 26 Oct 2003 15:30:05 +0000 (UTC)
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onlin
e.de!newsfeed.icl.net!newsfeed.fjserv.net!news.maxwell.syr.edu!postnews1.goo
gle.com!not-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:64575
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| (e-mail address removed) (Kevin Yu [MSFT]) wrote in message
| > Hi John,
| >
| > The common solution to this problem is let the second thread retrieve
data
| > from the database and post it to the main thread. When the main thread
gets
| > the data, let the main thread add it to the DataSet. Of course you have
to
| > lock the DataSet when accessing it in both threads. Thus, only one
thread
| > will access the DataSet when it is bound to a DataGrid.
| >
| > Does this answer your question? If anything is unclear, please feel
free to
| > reply to the post.
| How about an example? I think there must be a better way.
|
| What this means is that the DataSet is thread safe unless it's
| attached to a DataGrid. Right?
|
| Seems like there should be some sort of .Invoke method in this case?
|
| John
|
 
Back
Top