the_wayman
Member
- Joined
- Jan 9, 2009
- Messages
- 5
- Programming Experience
- 5-10
This a code to load a form as a child form in a mdiparent form every thing works fine. but when i try load a already loaded form it gives an error
Cannot access a disposed object. Object name: '<Form Name>'.
Here is the code....
Private Sub LoadPage(ByVal formToLoad As Form, ByVal Icon As Image)
If LoadDone = True Then 'LoadDone= false when no forms r loaded
frm.Close()
End If
pnBack.ValuesPrimary.Image = Icon
pnBack.ValuesPrimary.Heading = (formToLoad.Text)
frm = formToLoad
frm.MdiParent = Me
Me.pnBack.Panel.Controls.Add(frm)
frm.Width = Me.pnBack.Panel.Width
frm.Height = Me.pnBack.Panel.Height
frm.Show()
LoadDone = True
End Sub
Please i need some help urgently.
Thanks A lot in advance.
Cannot access a disposed object. Object name: '<Form Name>'.
Here is the code....
Private Sub LoadPage(ByVal formToLoad As Form, ByVal Icon As Image)
If LoadDone = True Then 'LoadDone= false when no forms r loaded
frm.Close()
End If
pnBack.ValuesPrimary.Image = Icon
pnBack.ValuesPrimary.Heading = (formToLoad.Text)
frm = formToLoad
frm.MdiParent = Me
Me.pnBack.Panel.Controls.Add(frm)
frm.Width = Me.pnBack.Panel.Width
frm.Height = Me.pnBack.Panel.Height
frm.Show()
LoadDone = True
End Sub
Please i need some help urgently.
Thanks A lot in advance.