VS  Copy / Paste Control(s) with Code

Top  Previous  Next

 C#   VB.NET   VB6   VB5   VBA 

The Copy / Paste Control(s) with Code feature allows you to copy and paste control(s) along with related code (event handlers) from a form, usercontrol, etc. to another.

MZ-Tools offers the following ways to copy control(s) with code:

  • The MZ-Tools | Copy Control(s) with Code menu.
     
  • The Copy Control(s) with Code button on the MZ-Tools - Main toolbar.
     
  • The Copy Control(s) with Code menu entry on the context menu of selected controls of a form.
     
  • In Visual Studio, the keyboard shortcut associated with the MZTools8.CopyControlsWithCode command.
     
  • In VB6 / VB5 / VBA, the keyboard shortcut associated with the Copy Control(s) with Code feature.

MZ-Tools offers the following ways to paste control(s) with code:

  • The MZ-Tools | Paste Control(s) with Code menu.
     
  • The Paste Control(s) with Code button on the MZ-Tools - Main toolbar.
     
  • The Paste Control(s) with Code menu entry on the context menu of a form.
     
  • In Visual Studio, the keyboard shortcut associated with the MZTools8.PasteControlsWithCode command.
     
  • In VB6 / VB5 / VBA, the keyboard shortcut associated with the Paste Control(s) with Code feature.

Remarks:

  • In Visual Studio, this feature only works with Windows Forms forms, not with WPF, Web, Silverlight or Smart Device forms.
     
  • In Visual Studio, the language of the source form and of the target form must be the same.
     
  • In VBA, this feature doesn't work with Access, since it only works with VBA UserForms (menu Insert > UserForm), not with Access forms, and Access lacks VBA UserForms.
     
  • The operation is not executed if any of the selected controls in the source form already exist in the target form.
     
  • This feature only works within the same IDE instance, not across different IDE instances.
     
  • In Visual Studio, the declaration of the event handler is generated by Visual Studio on the target form, rather than copied from the source form (this is due to technical reasons). That means that if you have modified the scope or the parameter names of the event handler in the source form, those modifications won't be applied to the event handler of the destination form.

See Also:

Keyboard Shortcuts Options