LucaMs Expert Licensed User Longtime User Feb 11, 2018 #1 [I could try it by myself, but since at this moment there is a very expert person online and I'm too lazy... ] I have (maybe) a global instance of a my class in the Starter service. I need to use it in more than one other "modules", an Activity, for example. What if I declare a Private variable in the Process_Globals of the Activity and I set it with a reference to the Starter object? [I hope it is clear ] Code: Copy ' Starter Public GlobalObj As MyClass Sub Service_Create GlobalObj.Initialize Code: Copy ' Activity Sub Process_Globals Private mObj As MyClass Sub Activity_Create mObj = Starter.GlobalObj I think this should work. (to avoid to write Starter.GlobalObj.SomeMethod each time )
[I could try it by myself, but since at this moment there is a very expert person online and I'm too lazy... ] I have (maybe) a global instance of a my class in the Starter service. I need to use it in more than one other "modules", an Activity, for example. What if I declare a Private variable in the Process_Globals of the Activity and I set it with a reference to the Starter object? [I hope it is clear ] Code: Copy ' Starter Public GlobalObj As MyClass Sub Service_Create GlobalObj.Initialize Code: Copy ' Activity Sub Process_Globals Private mObj As MyClass Sub Activity_Create mObj = Starter.GlobalObj I think this should work. (to avoid to write Starter.GlobalObj.SomeMethod each time )
LucaMs Expert Licensed User Longtime User Feb 11, 2018 #2 Despite my laziness, I have tried and it works, as expected. Useless question (but maybe useful topic) Upvote 0
Despite my laziness, I have tried and it works, as expected. Useless question (but maybe useful topic)
klaus Expert Licensed User Longtime User Feb 11, 2018 #3 I would put it here: Code: Copy ' Activity Sub Globals Private mObj As MyClass Upvote 0
LucaMs Expert Licensed User Longtime User Feb 11, 2018 #4 I prefer to use Globals only to declare views, but you're right, Klaus, I could declare that object in Globals. Upvote 0
I prefer to use Globals only to declare views, but you're right, Klaus, I could declare that object in Globals.