0

Hi Guys just want to ask advice regarding a form inside a control panel.

Its actually a ebook kind of program with table of contents.. See my screenshot below

enter image description here

On the left side are labels that when i click contents will be shown in the right panel.

Notes: Ive made 3 forms 1st form is the screenshot 2nd form has its own text contents and 3rd is another example below is my code:

Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
    Dim f3 As New Form3 With {.TopLevel = False, .AutoSize = False, .FormBorderStyle = FormBorderStyle.None}
    f3.Parent = Panel1
    Form2.Hide()
    f3.Show()

End Sub

Private Sub LinkLabel2_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked
    Dim f As New Form2 With {.TopLevel = False, .AutoSize = False, .FormBorderStyle = FormBorderStyle.None}
    f.Parent = Panel1
    Form.Hide()
    f.Show()

Cant seem to work this out. Thanks you!

T.S.
  • 18,195
  • 11
  • 58
  • 78
  • Form.Hide() does not do what you think it does. This is in general broken code, you must dispose the previous form object. While Panel1.Controls.Count > 0: Panel1.Controls(0).Dispose: End While – Hans Passant Nov 21 '15 at 20:52
  • I don't see a question here – T.S. Nov 22 '15 at 00:37
  • Hi Sir, sorry for the confusion. I tired @hansPassant advice to use dispose and it works. TYVM this is my assignment. Now can i ask final question? How to i do a simple table of contents? For example "+ Chapter 1" wherein when i press the "+" button sub-chapters will show on bullets? Is this possible? Thank you very much! – Jobet Avila Nov 22 '15 at 04:55

1 Answers1

0

Try adding the form as a control to the panel instead

Dim f As New Form2 With {.TopLevel = False, .AutoSize = False, .FormBorderStyle = FormBorderStyle.None}
Panel1.Controls.Add(f)
f.Show()
Ken Tucker
  • 4,126
  • 1
  • 18
  • 24