PC Review


Reply
Thread Tools Rate Thread

DataGridView Update

 
 
=?Utf-8?B?R2lvdmFubmk=?=
Guest
Posts: n/a
 
      11th Nov 2005
Hi All,

I am using VS 2005 and would like to accomplish the following:

Assuming I have 3-4 grids on a given Windows Form. I would like to
update these grids individually on a specified timer interval without
blocking the UI thread. When the info is available for a specific grid, it
is updated with the latest values from the SQL Server 2000 database backend.

What would be the best way to do this? I think I'd need to start a new
thread for each grid's Update/Refresh method or maybe even use the new
BackgroundThreadWorker object. Any ideas, hints, code tips (VB.NET).


Regards,

Giovanni P.
 
Reply With Quote
 
 
 
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      12th Nov 2005
Giovanni,

And this does mean that you wont try to update the data from your datagrids
to your database?.

Cor

"Giovanni" <(E-Mail Removed)> schreef in bericht
newsF396016-FF3B-43E8-9548-(E-Mail Removed)...
> Hi All,
>
> I am using VS 2005 and would like to accomplish the following:
>
> Assuming I have 3-4 grids on a given Windows Form. I would like to
> update these grids individually on a specified timer interval without
> blocking the UI thread. When the info is available for a specific grid,
> it
> is updated with the latest values from the SQL Server 2000 database
> backend.
>
> What would be the best way to do this? I think I'd need to start a
> new
> thread for each grid's Update/Refresh method or maybe even use the new
> BackgroundThreadWorker object. Any ideas, hints, code tips (VB.NET).
>
>
> Regards,
>
> Giovanni P.



 
Reply With Quote
 
=?Utf-8?B?R2lvdmFubmk=?=
Guest
Posts: n/a
 
      12th Nov 2005
Hi Cor,

No, the grids are for display purposes only to return real-time
inventory information from the warehouse.


Regards,

Giovanni

"Cor Ligthert [MVP]" wrote:

> Giovanni,
>
> And this does mean that you wont try to update the data from your datagrids
> to your database?.
>
> Cor
>
> "Giovanni" <(E-Mail Removed)> schreef in bericht
> newsF396016-FF3B-43E8-9548-(E-Mail Removed)...
> > Hi All,
> >
> > I am using VS 2005 and would like to accomplish the following:
> >
> > Assuming I have 3-4 grids on a given Windows Form. I would like to
> > update these grids individually on a specified timer interval without
> > blocking the UI thread. When the info is available for a specific grid,
> > it
> > is updated with the latest values from the SQL Server 2000 database
> > backend.
> >
> > What would be the best way to do this? I think I'd need to start a
> > new
> > thread for each grid's Update/Refresh method or maybe even use the new
> > BackgroundThreadWorker object. Any ideas, hints, code tips (VB.NET).
> >
> >
> > Regards,
> >
> > Giovanni P.

>
>
>

 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      13th Nov 2005
Giovanni,

I have not tried it yet, however I would first go in your case for the
backgroundworker class.

In my opinion is this made for that.

Cor


 
Reply With Quote
 
Michael McCarthy
Guest
Posts: n/a
 
      16th Nov 2005
Giovanni,
What you would do is use a System.Timers.Timer to run in a second thread,
someone suggested the Backgroundworker class, but this will only work if you
are using .net 2.0. You'll have to set up the AsyncResult yourself if you
are using .net 1.1

This is a pretty good summary of basically what you are trying to do from
Mike Taulty, this will also point you in the right direction if you have to
set up the AsyncResult yourself versus using the BackgroundWorker class...

http://www.microsoft.com/uk/asx/msdn...rvicecalls.asx

Since the background thread is trying to update the UI (in another thread,
which isn't allowed), you'll need to Invoke a delegate to refresh the
datagrid. A good example of using Invoke to do this can be found in the
excelent C# FAQ here:

http://blogs.msdn.com/csharpfaq/arch.../17/91685.aspx

Goodluck,
Michael.


"Giovanni" <(E-Mail Removed)> wrote in message
newsF396016-FF3B-43E8-9548-(E-Mail Removed)...
> Hi All,
>
> I am using VS 2005 and would like to accomplish the following:
>
> Assuming I have 3-4 grids on a given Windows Form. I would like to
> update these grids individually on a specified timer interval without
> blocking the UI thread. When the info is available for a specific grid,
> it
> is updated with the latest values from the SQL Server 2000 database
> backend.
>
> What would be the best way to do this? I think I'd need to start a
> new
> thread for each grid's Update/Refresh method or maybe even use the new
> BackgroundThreadWorker object. Any ideas, hints, code tips (VB.NET).
>
>
> Regards,
>
> Giovanni P.



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Refreshing Linq query to update second DataGridView when position in first DataGridView changes Arved Sandstrom Microsoft C# .NET 1 25th May 2008 04:06 AM
Can't Update Datagridview =?Utf-8?B?QXJuZSBCZXJ1bGRzZW4=?= Microsoft VB .NET 4 28th Nov 2006 06:47 PM
DataGridView Update =?Utf-8?B?R2lvdmFubmk=?= Microsoft Dot NET Framework Forms 0 11th Nov 2005 08:50 PM
datagridview will not update thomasp@msala.net Microsoft VB .NET 3 28th Sep 2005 06:13 PM
datagridview will not update thomasp@msala.net Microsoft VB .NET 1 28th Sep 2005 05:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:50 AM.