Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27189

using controls.remove to close a form inside a panel

$
0
0
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

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()

i tried
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()

But it does not work
i have done some google searching but can not find any info.

Viewing all articles
Browse latest Browse all 27189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>