Click here to Skip to main content
15,919,500 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to set visibility false of a picturebox that is on mdi parent form. I wrote following code on child form but it doesn't work...pls help me

C#
private void Bill_Issue_FormClosed(object sender, FormClosedEventArgs e)
        {
            MasterForm f = new MasterForm();
            f.pictureBox1.Visible = true;         
        } 


Thanks in adv.
Posted

hi,


first thing you do is to expose the parent form though properties.

for example

in the CHILD form



//create a properties with the typed of MDIform in CHILDFORM
// frmMainMDI


C#
public frmMainMDI ParentMDI
{
get{return this.ParentForm;}
set{this = value; }

}






call the CHILDFORM like this in MDI form



C#
frmChild ofrmChild = new frmChild()
ofrmChild.ParentMDI = this;
ofrmChild.show()








setting the picture box in MDIFORM:



C#
ParentMDI.PictureBox.Enable = false;
 
Share this answer
 
v3
If Bill_issue_Form is a child form then try

C#
private void Bill_Issue_FormClosed(object sender, FormClosedEventArgs e)
        {
            this.ParentForm.pictureBox1.Visible = false;               
        } 
 
Share this answer
 
v3
Comments
rajesh@1989 16-May-12 6:04am    
thanks for ur rply...
sorry i want to set pictureBox1.visible=true

i wrote your solution like this:

this.MyMdfForm.pictureBox1.visible=true;
but it does work.
Comfizzy 16-May-12 6:06am    
Cool stuff, you can mark my solution as an Answer.
rajesh@1989 16-May-12 6:53am    
picturebox1 always show visible false property

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