Public variables

Version 2021 Release 3, Windows 10

Desktop app

I am trying to open a database file for the entire app to use and to close with the app closes.

Created in APP
Properties
db as sqlitedatabase
dbfile as folderitem

db and dbfile are set to public and populate in the App Open0ing event handler. I viewed contents in debug.

Open works (try catch does not throw an error)

Created in Window1:

Method PopList
Var RS as RowSet
Var sql as String
var f As FolderItem = dbfile

Debug throws error:
This item does not exist
var f as Folderitem = dbfile (dbfile is highlighted)

I was using this to test the RS = db.sqelectsql(sql) line which gave the debug error
This item does not exist
RS = db.selectSQL (db is highlighted)

I thought adding properties to App with a scope of public should be available anywhere in the app, any window, method, etc.?

Any direction is helpful

TIA,
Sam

The App is a class, so you must use the fully-qualified name of the property when referring to it from outside the class (even if it’s public), e.g. App.dbfile

To have properties that are globally available by name they need to be public properties of a module.

Thanks for the quick response. Back to the app!