I am trying to create a Desktop Application that is basically a pet orphanage for people to donate and receive pets without home. I created my database and my design for the app, but my progress is blocked by the fact that whatever variables, parameters or anything I create inside the public : Form2 ( ) constructor cannot be used inside the rest of the code. I have multiple tutorials that I follow for the moment in order to create my application, and all of the use the same approach ( Create database connection inside the constructor of the form, where InitializeComponents() is located, then use that same connection throughout the code ).
I seem to encounter an issue that basically stops me from using anything created inside the constructor ( image below ).
This is stopping me not only with the connection. For example if I create an instance of an User Control like this:
ucHome home1 = new ucHome(); home1.BringToFront();
Everything is working fine and the UC is brought to front but if somewhere in the code ( anywhere ) like a Button-Click function I try to use the method home1.SendToBack() for example the code will not recognize home1 and will tell me it is undeclared.
Any ideas of how I might fix this?
Thank you!