You must Sign In to post a response.
  • Category: Visual Studio

    Subfolder name appears in namespace even after deleting it

    I had subfolder "mdichild" in c# solution in visual studio 2008 and was using it in code file as namespace.mdichild.

    now i have deleted subfolder "mdichild" from solution and placed forms under root directory.

    but still the subfolder name "mdichild" appears after namespace i.e. namespace.mdichild in code

    why does this occur even after subfolder deletion ?

    how to solve this problem so that subfolder name "mdichild" does not appear in code.
  • #759053

    Hi Jayesh.

    You have used the namespace as namespace.mdichild when you had subfolder. But now you deleted subfolder.

    Still it works since it takes the global namespace for that forms.

    If you want to remove subfolder name from code then do as follows.
    Suppose think you have Form1 under subfolder mdichild of your c# solution.
    1.Go to Form1.cs and remove mdichild word from namespace.
    2.Go to Form1.Designer.cs and remove mdichild word from namespace.
    3.Remove mdichild word from objects which you have created for Form1.

    Mark answer if you are staisfied.

    Regards

    Sridhar.
    DNS Member.
    "Hope for the best.. Prepare for the worst.."


    Sridhar Thota.
    Editor: DNS Forum.

  • #759055
    Have you refresh the solution explorer ?
    Have your restart your Visual studio ?
    After deleting sub folders solution will not take immediate effect. Please follow below steps
    1. Open your solution and click on Build and clean solution
    2. Click on rebuild menu to rebuild your project
    Now check if it gives your same error

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #759065
    Hello Jayesh,

    You have used the namespace as namespace.mdichild when you had subfolder. But now you deleted subfolder, But Still it will work since it takes the global namespace for that forms because when you design your form in c#, your designing will be saved into MyForm.Designer.cs file.

    Then if you are removing any folder or control's event, Still it will be there and it will throw you an error so you have to remove that line of code from MyForm.Designer.cs file.

    If you want to remove subfolder name from form then follow the below steps :
    1. Go to MyForm.Designer.cs and remove mdichild word from namespace.
    2. Remove mdichild word from objects which you have created for MyForm.

    Hope this will help you.
    Mark the answer if it helped you.

    Regards,
    Nirav Lalan
    DNS Gold Member
    "If you can dream it, you can do it."


  • Sign In to post your comments