how to remove the control from the winform by clicking the button on the control in the desin environment
-
Dear All: I create a usercontrol , there is a button in it, I place this control on one winform,I want to remove the control from the winform by clickinng the button on the control in design environment, how to write the code under the button_Click? Thanks in advance! Tramp
-
Dear All: I create a usercontrol , there is a button in it, I place this control on one winform,I want to remove the control from the winform by clickinng the button on the control in design environment, how to write the code under the button_Click? Thanks in advance! Tramp
-
Dear All: I create a usercontrol , there is a button in it, I place this control on one winform,I want to remove the control from the winform by clickinng the button on the control in design environment, how to write the code under the button_Click? Thanks in advance! Tramp
Well first you don't put the code for this in the control (bad habit). You expose a event on your control, the button click raises this event. Then on the form that contains the control you catch this event and there you write the code to remove the control. From memory (so you might want/need to adjust it a bit)
'in the event off the control
'customcontrol = the name of your control as it is named on the form
controls.remove(custumcontrol);You can also pass along the name of the control in the event, then you can replace 'customcontrol' with that. Hope this helps [EDIT]Adjust the code to c# (forgot I wasn't in the vb.net forum :) [/EDIT]
-
Dear All: I create a usercontrol , there is a button in it, I place this control on one winform,I want to remove the control from the winform by clickinng the button on the control in design environment, how to write the code under the button_Click? Thanks in advance! Tramp
mctramp168 wrote:
in design environment
You really want to do this in design enviroment rather than pressing the ‘Delete’ buttono?
:) I Love KongFu~
-
mctramp168 wrote:
in design environment
You really want to do this in design enviroment rather than pressing the ‘Delete’ buttono?
:) I Love KongFu~
thanks, I only want to know how to realize this function.