I have a Graph as user control and I’m trying to redraw the graph.
Why does this not work if i want to redraw the user control?
userGraph.Dispose();
new UserControls.Graph();
Shouldn’t it dispose the whole graph and redraw the user control and initialize all the components?
There should be another way to redraw your control, like update its data source or manually update its content – you should check its code or documentation.
But if you want to remove control from the form you should use
And if you want to add new control, then it should look like this:
Here is example from msdn: Control.ControlCollection.Add Method