Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Global Variables shared between forms
Message
From
30/07/2004 10:15:12
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00929416
Message ID:
00929573
Views:
8
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...
Previous
Reply
Map
View

Click here to load this message in the networking platform