Windows Develop Bookmark and Share   
 index > Windows Forms General > Moving controls to a panel results in losing it's events!
 

Moving controls to a panel results in losing it's events!

Hi! 0

 

(I use:VB.NETV2005Beta2,WindowApplication, SQL-database)

I have made a large Form with a lot of controls on it, (approx. 200!).

NOW, I come to the conclusion that most of them have to move,

from the windows form to (several) Panels.

 

Problem:0

After moving controls to a panel, VB renames all the controls, and place a '_1' after the names of the controls: for instance, MyButton_ClickEvent changes to MyButton_1_ClickEvent.

With this, all of the events are lost. Ofcourse this can be solved with

Contr_C & Control_V, but for 200 controls, this would be 5 hours work!

 

Question:0

Does somebody have a trick to overcome this?

Thanks!

 

Reinier

woef22  Friday, November 04, 2005 9:12 PM

Hi,

On the Form's Designer, do not use Cut and Paste to move your controls to a container, because cut and paste will force the controls to recreate; instead, select the controls you want to move and drag it to their new container, e.g., from your Form drag them to your Panel.

If however, you're trying to move controls froma Form to another Form, Cut and Paste in Code-View (InitializeComponents method call) is a better choice instead of doing it in the designer.


Regards,

-chris

Chris Vega  Monday, November 07, 2005 3:46 AM

Hi,

On the Form's Designer, do not use Cut and Paste to move your controls to a container, because cut and paste will force the controls to recreate; instead, select the controls you want to move and drag it to their new container, e.g., from your Form drag them to your Panel.

If however, you're trying to move controls froma Form to another Form, Cut and Paste in Code-View (InitializeComponents method call) is a better choice instead of doing it in the designer.


Regards,

-chris

Chris Vega  Monday, November 07, 2005 3:46 AM

You can use google to search for other answers

Custom Search

More Threads

• dynamic control event handling
• MonthCalendar holiday date collection in C#
• Did Bill forget document.selection for WebBrowser control?
• execute click button's event as a reguler method
• I want to write a code that's gonna display data into a chart when clicked
• [vc++ express] adding Items to ListView
• Custom Painted Controls?
• MDI child form inside panel?
• Table layout panel
• Dragging and Dropping an Object