How to replace the usercontrol dynamically
-
Hi, I'm using multiple usercontrol, I'm trying to display the usercontrol2 but usercontrol1 is not getting replaced with usercontrol2. please help me to solve this problem.:confused:
-
Hi, I'm using multiple usercontrol, I'm trying to display the usercontrol2 but usercontrol1 is not getting replaced with usercontrol2. please help me to solve this problem.:confused:
You can't replace a control, but you can create a new one and remove/hide the old. So in your code, create a new usercontorl2, add it to forms controls, place it in the right position and remove the usercontrol1 from forms controls. If you're using other containers inside the form (for example tabpage), place the control to the right containers controls collection.
The need to optimize rises from a bad design.My articles[^]