Make class in module accessible to the whole app

Hi all,

I was recently introduced to modules. I am looking to occasionally refresh some data and have created a module with a class called DataSet

I put this in my and it works within the event handler.

[quote] dataset = new SpyglassDBModule.DataSet()

But this dataset variable is not accessible in my window methods, so I won’t be able to set, get data.

I can’t quite figuire out how to make SpyglassDBModule.DataSet() accessible to the whole app. I will be populating an array with statistical data from a database.

How did you define the dataset variable? If you dim it in the app.Open event, then it’s only available in that event. You should make it a property of your module. Then remove the dim statement (if any) from app.Open and leave only

dataset = new SpyglassDBModule.DataSet()

in app.Open. dataset will now be available everywhere in your program.

That works, but I have to access it as


Is that what you meant, Tim? I’ve tried a property and shared property at the App level.


Mark it as Global so you can refer to it without any prefix.

Ahh, I need to make the class itself Global. Thanks.

Not the class itself, just the variable that holds the class instance. You might want to name them differently from each other, though.

Hmmm, now I get [quote]This item does not exist[/quote]

I can only set the property to Public, Protected, and Private.

Then you’re not making it a property of the module. If those are your options, it sounds like it’s in a class or in App.

Tim, you are right. I had it set in the app, not the module. Re-reading your original post, you clearly stated to make it a property of the module. All squared away now.