Panel

Posts 1–3 of 3 · Page 1 of 1
Panel
hi mpgh

i have a question
when i make a new panel:
Code:
Dim WithEvents p As New Panel
and then when i click on a button to add it into a flowlayoutpanel
Code:
FlowLayoutPanel1.Controls.Add(p)
and then i press a button to panel adds to to the flowlayoutpanel but when i press again the button nothing happens

so... i just can add i one time??
[highlight=vbnet]Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim p As New Panel
'Set panel properties here...
p.BackColor = Color.Blue
FlowLayoutPanel1.Controls.Add(p)
End Sub[/highlight]
Quote Originally Posted by Kudi View Post
hi mpgh

i have a question
when i make a new panel:
Code:
Dim WithEvents p As New Panel
and then when i click on a button to add it into a flowlayoutpanel
Code:
FlowLayoutPanel1.Controls.Add(p)
and then i press a button to panel adds to to the flowlayoutpanel but when i press again the button nothing happens

so... i just can add i one time??
You've initialized your panel outside the method, so you can only use it once. As hassan showed in his code you'll need to create multiple panels if you want to add more than 1 to the control.
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?