Hi

I have two forms MainForm and DisplayForm. From MainForm i get the file name on button click and load the form in picturebox placed on display form... Can any one tell me how to do that???

Thanks in advance

Recommended Answers

All 8 Replies

pass file name as string to the constructor or display form and in diplayform_load event load it in picture box just like suggested in this thread

Do you get file name from the textbox of the Main form. If so you no need to pass the filename. get the filename from the mainform's textbox!!

That is not possible samueal because controls of a form are declared private and cannot be manipulated from outside the form

Thanks Abellazm... samueal i have tried your solution but it is giving a number of exceptions can you please explain it???? If it is good then is much easier than that of what abellazm has suggested.

That is not possible samueal because controls of a form are declared private and cannot be manipulated from outside the form

Yes but it is easier to change it to public!!

Thanks Abellazm... samueal i have tried your solution but it is giving a number of exceptions can you please explain it???? If it is good then is much easier than that of what abellazm has suggested.

Can u please specify the exceptions??

Thanks Abellazm... samueal i have tried your solution but it is giving a number of exceptions can you please explain it???? If it is good then is much easier than that of what abellazm has suggested.

Change the textbox in the Mainform to Public and access the values from other form

Yes it is pretty obvious that changing private controls to public but it is against conventions anyway one can do that if it is feasible for him.:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.