I’m using Compact Framework 2.0 for an application in Windows CE 5.0 device with multiple forms.
I have to use a connection string in almost all the forms in order to access to the database:
string conString = "Data Source=\\Program Files\\myproject\\database.sdf";
I would like to know if it’s possible to make this connection string somehow “global” in order to be written only once and accessible from all the forms.
As per @Steven’s comment, you should really add this in the config file, however see below for an example of what you asked for.
Create a class for it and make it a public const field.
Then in your forms (or anywhere else) you could access it as
Globals.conString.