J
John Smith
I want to share a variable between multiple forms in a Windows app. Where do
I declare the variable ?
I came up with one way that is to declare it as a member of the MainForm,
and then access it using
((MainForm)Application.OpenForms[0]).<MyVariableName>.
Is there a more elegant or better way? Btw, the variable I'd like to share
is an open SqlConnection.
Thanks!
I declare the variable ?
I came up with one way that is to declare it as a member of the MainForm,
and then access it using
((MainForm)Application.OpenForms[0]).<MyVariableName>.
Is there a more elegant or better way? Btw, the variable I'd like to share
is an open SqlConnection.
Thanks!