Syntax for use of db declared as public


I cannot find the correct syntax to use a Public item
I have tried app.db and also the use of ps as printer
nothing I have tried works :frowning:
They are both declared in the “APP” settings

App.whatever as long as they are public

To refer to properties of the App class, use the syntax App.PropertyName.

If you are already doing that but are getting a NilObectException when trying to use the property, be sure you are initializing it first with the New keyword:

App.db = New SQLiteDataBase // initialize first
App.db.SQLSelect(...) // then use

Not every time.

You can do it in the app’s Opening event, or ‘just in time’, like this

if App.db = nil then app.db = New SQLiteDataBase // initialize if nil when you get here
App.db.SQLSelect(...) // then use

Thanks very much .. I was using “as” when I should be using “=”

You can add a module and add your properties there.

Pro: No App. prefix
Con: ?