[VB] Globale Variablen definieren
Hallo,
ich möchte gerne eine Variable deklarieren bei der ich von jeder Page zugreifen kann. Ich habe mal irgendwo gelesen das man in der App.xaml.vb was reinschreiben muss.
Hier habt ihr mal ein Zitat aus dem AppHub Forum von einem User:
Zitat:
Use basic C# language concepts (nothing special about the phone or app.xaml.cs). The simplest way is to define a public static variable in any public class (e.g. [FONT=courier new]public static int MyGlobalInt;[/FONT] in the App class in App.xaml.cs), then you can access it anywhere in the app with [FONT=courier new]App.MyGlobalInt[/FONT]. For something accessible throughout the app, it usually makes sense to put a global inside the App class, but you can really put it in any class you want (e.g. MainPage) and access it with classname.GlobalVariableName. |
|
AW: [VB] Globale Variablen definieren
Ich hab mal diese Seite hier bemüht: http://www.developerfusion.com/tools.../csharp-to-vb/
Die hat mir aus: public static int GlobalInt;
das hier gezaubert: Public Shared GlobalInt As Integer
Kann selbst nur C# und kein VB.Net aber scheint mir als Übersetzung zu passen.
AW: [VB] Globale Variablen definieren
Vielen Dank! Es funktioniert!