To delete one or more objects from the form, select them either on the
Design Canvas
or in the
Outline view and press
Delete. Alternatively,
right-click and select
Delete from the context menu.
When a
control is deleted from the Design Canvas:
- If it is a container control, any child controls that it contains are also
deleted.
- All event-handling code related to a deleted control is removed from the class
file, provided it is not used by any other control.
The Undo option is available to reverse a deletion if
necessary.
When you delete a control with the Visual Designer, the assembly
reference is not automatically removed from the
assemblies.xml file or from the
Project Explorer view. Although unused assembly references
do no harm, if you want to delete them, you must do so manually. You can use the
Assemblies dialog in project properties (). Directly editing the
assemblies.xml file is not recommended.
Note: You cannot delete the visual container object (the form
itself).