Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Updating winform progress bar from a class
Message
 
À
06/01/2005 16:27:58
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00974845
Message ID:
00974986
Vues:
31
>Hi I am able to update a winforms progress bar from a method in a class if
>i pass it a ref to the progress bar however I remember seeing an article about using "delagate"? to accomlish the same thing.

It depends entirely on what you are doing really. If you're in a method of the form it may be perfectly acceptable to just go ahead and call the progress bar and update it.

The problem I suspect you have is that you're calling from a different object and that object has a problem because the progress bar is defined as private on the form.

What I usually do for things like this is add special methods to the form that deal with common UI operations like updating statusbars or progress bars etc. These methods are public and can be called externally.

This is good practice for a number of reasons: The above to expose your 'UI updating logic in a public interface' and more importantly if you plan on using multi-threaded interface logic, a common entry point that you can abstract for thread safe UI access via Invoke method calls that have simple signatures that provide only the parameters you need to make the snchronized UI updates.

+++ Rick ---
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform