Access a property in another form

  • Thread starter Thread starter Diego F.
  • Start date Start date
D

Diego F.

I'm writing an application that has some forms. I need an object in the main
form, but I'm not sure about how to access it from other forms.

Which is the best way to do it? Can I declare the object as static and
access directly the form?
 
I'm writing an application that has some forms. I need an object in the main
form, but I'm not sure about how to access it from other forms.

Which is the best way to do it? Can I declare the object as static and
access directly the form?

You could pass your other forms a reference to the main form when you are
creating them too and then have the object they need to access exposed as
a public field or property.
 

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