Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Accessing the Main Application Window
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00875619
Message ID:
00875898
Vues:
19
Nate,

Thank you for the reply. I will try what you suggested, but I thought there was something already build into MM .Net. The framework includes an application object with properties, but I can not figure out if I can add my own properties and then how they could be accessed from the rest of the application.

I have an accounting application that sets an accounting period (date range) that all forms will use to determine what data is displayed.

Kind Regards,

Mat

>
>The quick answer to your question is that you can add Method/Properties to MainForm, but they have to be static methods or props. That carries with it the limitations (and power) of Static types in .Net
>
>You can do something else in this case though, which will let you get to the instance variables and other non-static things through a static reference that is accessible everywhere in your winforms project:
>
>1) Add a static variable to your MainForm of type MainForm.
>
>
>public static MainForm oInstanceRef;
>
>
>2) In the Load event of Mainform, set that static variable to the instance of MainForm:
>
>
>MainForm.oInstanceRef = this;
>
>
>Now, from anywhere in your project, you should be able to get to the running instance of MainForm, including any custom stuff you’ve added to it. There might already be something in MM.Net that handles this too...
>
>-Nate
Matthew Kennedy
Decision Support Technology Inc.

"I try to take one day at a time, but sometimes several days attack me all at once." ~ Ashleigh Brilliant

New Jersey Dot Net User Group
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform