VS  Copy / Paste Control(s) with Code

Top  Previous  Next

 C#   VB.NET   VB6   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 2015 and higher, the keyboard shortcut associated with the MZTools.CopyControlsWithCode command.
  • In Visual Studio 2013 and lower, the keyboard shortcut associated with the MZTools8.CopyControlsWithCode command.
  • In VB6 / 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 2015 and higher, the keyboard shortcut associated with the MZTools.PasteControlsWithCode command.
  • In Visual Studio 2013 and lower, the keyboard shortcut associated with the MZTools8.PasteControlsWithCode command.
  • In VB6 / 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 Microsoft Access forms, it only works with VBA UserForms (Insert | UserForm menu) since MZ-Tools 8.0 is an add-in for the VBA editor and not an add-in specific for Microsoft Access.
  • 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