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

anybody help me the below code
i have textbox.text and button1 on form1
form2 picturebox

if i click form1 button it should be print or draw on form2 picturebox form form1 entered in textbox.text

thanks
Posted

1 solution

Don't. Pass the text to Form2 - via a method or a property - and have it draw the text.
That way, Form2 doesn't need to know Form1 exists, it just gets on with the job. So if you need to make changes to Form2 later, you don't have to consider the effects on other forms.

Exactly how you do it depends on the "relationship" between the forms. In essence if FormX creates an instance of FormY, then FormX is the "Parent" and FormY is the "Child", and exactly how to handle the communications differs according to that, as a "Parent" needs to know about "Children", but "Children" don;t need to know about it's "Parent" or other "Children".
Have a look at these:
Transferring information between two forms, Part 1: Parent to Child[^]
Transferring information between two forms, Part 2: Child to Parent[^]
Transferring information between two forms, Part 3: Child to Child[^]
 
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