Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Global Variables shared between forms
Message
 
To
29/07/2004 19:29:43
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00929416
Message ID:
00929431
Views:
10
>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
Next
Reply
Map
View

Click here to load this message in the networking platform