Reputation: 2074
Hi there I have a user control in my project and I want to add this user control to a form when I click on a button.
This is the code I wrote:
Using GstAbonnement As New GestionAbonnement() With {.Dock = DockStyle.Fill}
Panel1.Controls.Add(GstAbonnement)
End Using
The problem is when I click on the button nothing happens
Upvotes: 0
Views: 5449
Reputation: 1177
try this
Dim GstAbonnement As New GestionAbonnement()
GstAbonnement.Dock = DockStyle.Fill
Panel1.Controls.Add(GstAbonnement)
After you are done with the control, dispose it
GstAbonnement.Dispose()
Upvotes: 2