StrataFrame Forum

Declaring a global object...

http://forum.strataframe.net/Topic5244.aspx

By StarkMike - 12/12/2006

I would like to declare a global object but not instantiate it and I dont want the 'Dim' statement in any of my forms... I was thinking I could put it in the AppMain class, but I'm not sure where to put it. Could you provide some direction?

Thanks

By StrataFrame Team - 12/12/2006

One of those "Shared" classes would be perfect for you.  You can "Dim" the business object within the class and it becomes publicly available as a global variable from anywhere within your application.

Public NotInheritable Class MyBOContainer

    Public MyGlobalBusinessObject As New MyBOType()

End Class

You can then access it anywhere with this:

MyBOContainer.MyGlobalBusinessObject