hi i am using controls.add to open a form inside a panel of another form but i am stuck on trying to remove the form from the panel when i click a button
this is how i add the form
then when the user clicks a button i need to close the form and open a new one inside the panel
i tried
But it does not work
i have done some google searching but can not find any info.
this is how i add the form
Code:
Dim f As New Frm_Status
f.TopLevel = False
Me.Form_Panel.Controls.Add(f)
f.Location = New Point((Me.Width - f.Width) \ 100, (Me.Height - f.Height) \ 4) ''width moves left and right - Height moves up and down
f.Show()
then when the user clicks a button i need to close the form and open a new one inside the panel
Code:
Dim P As New Frm_Profiles
P.TopLevel = False
Me.Form_Panel.Controls.Add(P)
P.Location = New Point((Me.Width - P.Width) \ 100, (Me.Height - P.Height) \ 4) ''width moves left and right - Height moves up and down
P.Show()
Code:
Me.Form_Panel.Controls.Remove(f)
'and
Me.Form_Panel.Controls.Remove(Frm_Status)
Dim P As New Frm_Profiles
P.TopLevel = False
Me.Form_Panel.Controls.Add(P)
P.Location = New Point((Me.Width - P.Width) \ 100, (Me.Height - P.Height) \ 4) ''width moves left and right - Height moves up and down
P.Show()
i have done some google searching but can not find any info.