Thank you everyone for the replies.
Ivan, it was indeed the db object, thank you.
This was declared in the “opening” method of Window1 Var db As New MySQLCommunityServer
and there is a db “Property” (public) in the “opening” event handler of Window1.
This is exactly how the code is laid out in the youtube tutorial.
I come from a Lazarus/ Pascal background and would normally use a global variable if I wanted to access the variable in a different window / control (although to access a mysql server i would use zconnection, zquery and datasource components so to make a connection it is totally different)
I dont mind admitting I’m struggling a little to get my head around the differences in the IDE / the way things work.
Is there a setting in the IDE to make declared variables or poroperties global, or should i be using the property / declaration differently ?.
you can use a global modul property or a property in the app (for desktop projects)
you can also sub class this database class to make it more handier.
I managed to sort this myself after reading various posts on the forum.
For anyone else struggling, here is how i did it (happy to hear any other solutiuons).
From the Xojo menu choose insert / module, this will give you an icon called Module1 (in the contents window if that is what it’s called), there’s a hint here that this is global as the icon is one of planet earth,
In this module, create a property called db and give it a type of MySQLCommunityServer.
Change the declaration of the variable from “var db As New MySQLCommunityServer” (this would be a declaration of a local variable) to “db = NEW MySQLCommunityServer”
Because they behave differently. Variables go out of scope at the end of a method. Properties live on the object you’ve defined them on. A Module property lives forever, a Class property lives for the duration of the class instance.