I have a listbox with items and a panel. What I want to do is when I click on an item, a label shows up in a panel, which was already there before the item was clicked. I've managed to show the label, but it didn't add to the panel, instead went to the back of the panel. How could I fix this? I've already tried to code the label to bring it to front, but it didn't work.
Here is the code I have so far:

Dim MyLinkLabel As New Label()
        With MyLinkLabel
            .Location = New Point(205, 90)
            .Visible = True
            .AutoSize = True
        End With

        Me.controls.add(MyLinkLabel)
        MyLinkLabel.Text = "Information"

        Dim myfont As New Font("Mistral", 23, FontStyle.Regular)
        MyLinkLabel.Font = myfont

Recommended Answers

All 2 Replies

You have to add it to the panel, not the form as in

pnlMyPanel.Controls.Add(MyLinkLabel)

Thank you very much!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.