Windows Develop Bookmark and Share   
 index > Windows Forms General > Picture Box Image in the parent form
 

Picture Box Image in the parent form

I have a small dialog window as an MDI child to select an image for a picture box in the parent form. The requirement is to display the selected image in the picture box immidiately after I select and hit OK from the child so the user can see the image before saving.
I am able to load the image file as a binary data file and also save it to the database but it doesnt display the picture right away in the picture box. Does any one know how that could be achieved, I have tried something like this but its not working:
From the child:
parentForm obj=new parentForm();
obj.LoadPicture(picturePath);
In the parent:
private void LoadPicture(string path)
{
pictureBox.Load(path);
}
I think I need to use events but I am not good at it.
Please help.
Thanks

coolarian  Tuesday, August 07, 2007 2:43 PM
Your use of "new" is invalid. You are creating a new instance of the parent form instead of using the existing one. Use this instead:

parentForm obj = (parentForm)this.MdiParent;

nobugz  Tuesday, August 07, 2007 7:05 PM
Your use of "new" is invalid. You are creating a new instance of the parent form instead of using the existing one. Use this instead:

parentForm obj = (parentForm)this.MdiParent;

nobugz  Tuesday, August 07, 2007 7:05 PM

You can use google to search for other answers

Custom Search

More Threads

• Disable TreeView node selection?
• how to input text in TextBox control which is inserted into a RichTextBox control
• How do I modify column captions in DATAGRID control using vb.net?
• Inheritance ?
• data base
• Load tab on demand?
• DatagridView copy/paste and Read Only
• Hi!! is there any way in C# n visual stdio 2005 that we can...........
• Get host app name in license
• Notification to Flash on taskbar in Vb.net