Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Global Variables shared between forms
Message
De
30/07/2004 10:15:12
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00929416
Message ID:
00929573
Vues:
7
This worked great.

>>In Visual FoxPro if I wanted to have a global variable available to all forms I would create a property on the screen, then it would be accessible by all forms. How do you do this type of global variable access in VB.NET? For example, I have a customer form. When the user selects a customer on that form then activates a customer orders form, I want the orders from to display data for the selected customer. The Customer Orders form is called from the main menu not from the customer form, so I can't pass a parameter.
>
>Robert,
>
>I'm not for sure if this is the best method, but I have found this very effective... Add a new Class to your project. Then, within the class declare some variables as Public Shared...
>
>Ex:
>
>'* This class is used for housing the public variables
>Public Class PublicStuff
>
>    ' These can be accessed from anywhere
>    Public Shared sVar As String
>    Public Shared nVar As Integer
>
>End Class
>
>Then, those variables can be accessed anywhere throughout the application.
>
>Ex:
>
>PublicStuff.sVar = "Test"
>
>The same holds true for ASP.net as well... Hope that helps...
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform