Sharing objects across forms and other objects

  • Thread starter Thread starter Evan
  • Start date Start date
E

Evan

Hi,

What is the best method to share objects (such as a SqlConnection)
across many forms. I am currently passing the SqlConnection in to
other forms from the main form through the other forms' constructor.
This is becoming cumbersome when dealing with dozens of forms. What
are the alternatives?

Thanks in advance,
Evan
 
Hi evan,

You can create a class with static members for these escenario, you could
also use a singleton for this.

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top