Home All Groups Group Topic Archive Search About
Author
11 Nov 2005 8:51 PM
Giovanni
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.
Author
12 Nov 2005 8:58 AM
Cor Ligthert [MVP]
Giovanni,

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

Cor

Show quoteHide quote
"Giovanni" <Giova***@discussions.microsoft.com> schreef in bericht
news:DF396016-FF3B-43E8-9548-A6E144F8060F@microsoft.com...
> 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.
Are all your drivers up to date? click for free checkup

Author
12 Nov 2005 3:03 PM
Giovanni
Hi Cor,

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


     Regards,

                  Giovanni

Show quoteHide quote
"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" <Giova***@discussions.microsoft.com> schreef in bericht
> news:DF396016-FF3B-43E8-9548-A6E144F8060F@microsoft.com...
> > 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.
>
>
>
Author
13 Nov 2005 8:05 AM
Cor Ligthert [MVP]
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
Author
16 Nov 2005 9:37 AM
Michael McCarthy
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/nuggets/asynchronouswebservicecalls.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/archive/2004/03/17/91685.aspx

Goodluck,
Michael.


Show quoteHide quote
"Giovanni" <Giova***@discussions.microsoft.com> wrote in message
news:DF396016-FF3B-43E8-9548-A6E144F8060F@microsoft.com...
> 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.

Bookmark and Share