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:
00876110
Vues:
21
This message has been marked as the solution to the initial question of the thread.
Mat,

>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.

Nate is saying that if you want to add properties to the main form (or as you suggested here, the application object), you can simply make it a static field like this (or a property):
class AppDesktop : mmAppDesktop
{
	public static DateTime StartDate;
	public static DateTime EndDate;
}
Then you can access these fields from anywhere within your application like this:
StartDate Begin = AppDesktop.StartDate;
However, if you want to add "instance" members rather than static members, you can specify these as follows:
class AppDesktop : mmAppDesktop
{
	public DateTime StartDate;
	public DateTime EndDate;
}
Then you can access these fields from anywhere within your application like this:
StartDate Begin = AppMainEntry.App.StartDate;
This is possible because the AppMainEntry class (located in Main.cs) already contains a static field called "App" that contains a reference to your application object.

Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform