Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all,

i've two forms MainForm1 and Form2.i want to access object of MainForm1 in form2.Please reply with an exp.
Posted

This is bad practice, but if you insist on doing it, just make the control/object accessibility modifier public, and as long as the form is instantiated, you can get to it from anywhere that can get to the form.
 
Share this answer
 
You probably also want to look at delegates so that form2 can then run methods on form1
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900