Rebuild Windows Forms Designer Generated Code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gsilvey

    Rebuild Windows Forms Designer Generated Code

    Is there a way to rebuild the code that is generated by the forms designer? It compiles, but it seems to have controls left in it that I previously removed using the designer. I'd like to just rebuild it all to ensure it is clean and does not have unnecessary code in it. (The Rebuild command does not do this.)
  • Jay B. Harlow [MVP - Outlook]

    #2
    Re: Rebuild Windows Forms Designer Generated Code

    gsilvey,
    The "Oh my god, what have I done method":
    - Open your form in the Forms Designer
    - Use Edit Select All to select all the controls
    - Use Edit Delete to delete all the controls
    - Use the toolbox to add all the controls you actually want
    - Use the properties window to set the properties you actually want

    Otherwise, there is no way to "rebuild" the code, as the code generated IS
    your form design (the design is not stored any place else). There is
    additional information on the design in the .resx file, however the bulk of
    the form's design is the generated code itself.

    Hope this helps
    Jay

    "gsilvey" <anonymous@disc ussions.microso ft.com> wrote in message
    news:A575489A-842E-4B5E-89C2-613EA8CDF238@mi crosoft.com...[color=blue]
    > Is there a way to rebuild the code that is generated by the forms[/color]
    designer? It compiles, but it seems to have controls left in it that I
    previously removed using the designer. I'd like to just rebuild it all to
    ensure it is clean and does not have unnecessary code in it. (The Rebuild
    command does not do this.)


    Comment

    • Cor Ligthert

      #3
      OT

      Hi Jay,

      I was just thinking about you and thought, Jay never makes jokes in this
      newsgroup always serious and than this.
      [color=blue]
      > The "Oh my god, what have I done method":[/color]

      I was really laughing (friendly of course).

      Cor


      Comment

      • Jay B. Harlow [MVP - Outlook]

        #4
        Re: Rebuild Windows Forms Designer Generated Code

        Cor,
        I wanted to make sure that gsilvey was thinking before he actually tried my
        method...

        Jay

        "Cor Ligthert" <notfirstname@p lanet.nl> wrote in message
        news:uG5oDIXSEH A.2692@TK2MSFTN GP09.phx.gbl...[color=blue]
        > Hi Jay,
        >
        > I was just thinking about you and thought, Jay never makes jokes in this
        > newsgroup always serious and than this.
        >[color=green]
        > > The "Oh my god, what have I done method":[/color]
        >
        > I was really laughing (friendly of course).
        >
        > Cor
        >
        >[/color]


        Comment

        • gsilvey

          #5
          Re: Rebuild Windows Forms Designer Generated Code

          I've got way too many controls to do that. Your suggestion gave me an idea though. I did a select all and then a delete. I then went to the source viewer and removed what was left. There were still about 20 controls in there. I then went back to the designer and did a paste. That seems to have worked, however I still get the error I was previously getting... (See my other thread here about InitializeCompo nent() exception in .NET General

          Comment

          Working...