'.ctor' is not a valid identifier .net 2005 Designer Problem

Răspuns propus '.ctor' is not a valid identifier .net 2005 Designer Problem

  • 8 februarie 2006 12:02
     
     
     

    I am frequently facing this problem in Visual Studio 2005 Designer.

    i have searched all files of my project, '.ctor' is mentioned nowhere

    One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes.


    '.ctor' is not a valid identifier.

    Hide    


    at Microsoft.VisualStudio.Shell.Design.Serialization.CodeDom.CodeDomEventBindingService.ValidateMethodName(String methodName)
    at System.ComponentModel.Design.EventBindingService.EventPropertyDescriptor.SetValue(Object component, Object value)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAttachEventStatement(IDesignerSerializationManager manager, CodeAttachEventStatement statement)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)

Toate mesajele

  • 3 noiembrie 2010 13:35
     
     
    Has anybody found the resolution to this problem?  I'm getting the exact same error in VS 2010.
  • 3 noiembrie 2010 15:33
     
      Are cod

    Are you using VB.Net ?

    if so, you probably have a method (Sub or Function) which has the same name as the enclosing class.
    This error is recognized and reported by c# compiler, but not by VB compiler.

    ctor is a constructor, declared in VB. as 

    Sub New()
       ' ...
    End Sub
    
    Regards,
    Vladimir

  • 4 noiembrie 2010 18:43
     
     

    Yes, I'm using VB.NET.  (Visual Studio 2010 Version 10.0.30319.1 RTMRel)

    Would you know how I can find the problem & fix it? 

    I've done a search for .ctor for the "Entire Solution" but it doesn't find anything.

  • 4 noiembrie 2010 19:11
     
     Răspuns propus Are cod

    Let's say your form (the one that can not be opened in designer) is called FormMain. Close the designer if it's opened.

    Open FormMain.vb file and look for a procedure or function that has the same name - FormMain
    (search the file by the class name) ... something like :

     

    Private sub FormMain()
     ' ...
    End Sub
    

     

    Rename that procedure, anything else ... Private Sub FormMain_SomethingSomething()   :)

    Rebuild project, open the form in designer.

    • Propus ca răspuns de DaveWendt 5 noiembrie 2010 14:31
    •  
  • 5 noiembrie 2010 14:24
     
     
    That did the trick!  Thank you very much!
  • 1 martie 2012 18:48
     
     
    Thanks worked for me too! Awesome!