none
Delete hidden or missing control? (Required method for Designer support - do not modify the contents of this method with the code editor.) RRS feed

  • Question

  • Dear All,

    There is a control in my Form1.Design.cs file but it can NOT be found on Document Outline Window,

    How to delete this control ?

    Thanks and Best regards,

    E-John



    • Edited by E-John Thursday, September 19, 2019 9:18 AM
    Tuesday, September 17, 2019 9:28 AM

Answers

  • Hi E-John,

    If you write the code in the Form1.Design.cs directly, please confirm you have used method "Controls.Add()" to add the control to Form1. If not, it will not be displayed in the Document Outline Window.

    The other way, you can drag the control from the Toolbox directly, then the control will be displayed in the Document Outline Window.

    If you want to delete the control that not found, just delete the corresponding code in the Form1.Design.cs.

    Regards,

    Kyle


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by E-John Wednesday, September 18, 2019 8:38 AM
    Wednesday, September 18, 2019 7:45 AM
    Moderator

All replies

  • Hi E-John,

    If you write the code in the Form1.Design.cs directly, please confirm you have used method "Controls.Add()" to add the control to Form1. If not, it will not be displayed in the Document Outline Window.

    The other way, you can drag the control from the Toolbox directly, then the control will be displayed in the Document Outline Window.

    If you want to delete the control that not found, just delete the corresponding code in the Form1.Design.cs.

    Regards,

    Kyle


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by E-John Wednesday, September 18, 2019 8:38 AM
    Wednesday, September 18, 2019 7:45 AM
    Moderator
  • Hi Kyle,

    Thanks for your explanations. Just don't know which step went wrong on my side and this unused control is left.

    It was found because I am doing code refine.

    Thanks and Best regards,

    E-John

    If you write the code in the Form1.Design.cs directly, please confirm you have used method "Controls.Add()" to add the control to Form1. If not, it will not be displayed in the Document Outline Window.

    ---> The controls are always drag-and-drop from toolbox, I don't write code in the Form1.Design.cs

    There is not "Controls.Add()" for adding this control to Form1.

    Thanks for your explanations, now I understood why it can not be found in the Document Outline Windows.

    The other way, you can drag the control from the Toolbox directly, then the control will be displayed in the Document Outline Window.

    ---> Yes, that is the way I used to add control to Form1.

    If you want to delete the control that not found, just delete the corresponding code in the Form1.Design.cs.

    ---> OK, I will delete it manually. I did not delete it because there is a comment before the InitializeComponent().

            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>

            private void InitializeComponent()
            {

            ...

            }

    Wednesday, September 18, 2019 8:38 AM