InitializeComponent code lost

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

    #1

    InitializeComponent code lost

    when i build the project using C#, the code in
    InitializeCompo nent lost sometimes. Is it a bug?? if yes,
    can some method fix it? thanks for help.

    Tabo
  • codewriter

    #2
    Re: InitializeCompo nent code lost

    The problem here is this. If you add your own code to the
    InitializeCompo nent and then add a new control to your form or delete a
    control from your form, then your code may become deleted. Microsoft
    actually warns about it and does not recommend to add your own code to the
    InitializeCompo nent. That's why there is a comment added to it:
    /// <summary>

    /// Required method for Designer support - do not modify

    /// the contents of this method with the code editor.

    /// </summary


    You'll be better off adding your code to the constructor. So, it's not a
    bug, it's a feature.

    "Tabo" <kathy_tabo@hot mail.com> wrote in message
    news:098f01c362 11$2d77d520$a40 1280a@phx.gbl.. .[color=blue]
    > when i build the project using C#, the code in
    > InitializeCompo nent lost sometimes. Is it a bug?? if yes,
    > can some method fix it? thanks for help.
    >
    > Tabo[/color]


    Comment

    • Luc Kumps

      #3
      Re: InitializeCompo nent code lost

      I don't know about Tabo's problem, but I loose *all* code in
      InitializeCompo nent *very* regularly.
      After I make a change to my .aspx page (in html source view), this method is
      wiped out *completely* by my VS.Net 2003. Everything's gone: event handlers,
      property initialisation, everything, InitalizeCompon ent is completely
      empty...

      This is driving me mad. I regularly save the contents of InitializeCompo nent
      in a separate file, so I can copy and paste it whenever needed (which
      happens to be several times a day)...
      I had this in the original VS.Net, and the 'feature' is still there in
      VS.Net 2003...

      Luc K

      "codewriter " <code_writer_20 03@yahoo.com> wrote in message
      news:e1E_a.5083 $kp4.834536@new s20.bellglobal. com...[color=blue]
      > The problem here is this. If you add your own code to the
      > InitializeCompo nent and then add a new control to your form or delete a
      > control from your form, then your code may become deleted. Microsoft
      > actually warns about it and does not recommend to add your own code to the
      > InitializeCompo nent. That's why there is a comment added to it:
      > /// <summary>
      >
      > /// Required method for Designer support - do not modify
      >
      > /// the contents of this method with the code editor.
      >
      > /// </summary
      >
      >
      > You'll be better off adding your code to the constructor. So, it's not a
      > bug, it's a feature.
      >
      > "Tabo" <kathy_tabo@hot mail.com> wrote in message
      > news:098f01c362 11$2d77d520$a40 1280a@phx.gbl.. .[color=green]
      > > when i build the project using C#, the code in
      > > InitializeCompo nent lost sometimes. Is it a bug?? if yes,
      > > can some method fix it? thanks for help.
      > >
      > > Tabo[/color]
      >
      >[/color]


      Comment

      • Luc Kumps

        #4
        Re: InitializeCompo nent code lost

        Forgot to tell that this is supposed to fix the problem in VS .Net 2002:
        http://support.microsoft.com/?kbid=324199&sd=msdn

        (unfortunately it's still there in VS .Net 2003)

        Luc K

        "Luc Kumps" <NOkumpsSPAM@pa ndora.be> wrote in message
        news:Vua0b.7412 1$F92.8463@afro dite.telenet-ops.be...[color=blue]
        > I don't know about Tabo's problem, but I loose *all* code in
        > InitializeCompo nent *very* regularly.
        > After I make a change to my .aspx page (in html source view), this method[/color]
        is[color=blue]
        > wiped out *completely* by my VS.Net 2003. Everything's gone: event[/color]
        handlers,[color=blue]
        > property initialisation, everything, InitalizeCompon ent is completely
        > empty...
        >
        > This is driving me mad. I regularly save the contents of[/color]
        InitializeCompo nent[color=blue]
        > in a separate file, so I can copy and paste it whenever needed (which
        > happens to be several times a day)...
        > I had this in the original VS.Net, and the 'feature' is still there in
        > VS.Net 2003...
        >
        > Luc K
        >
        > "codewriter " <code_writer_20 03@yahoo.com> wrote in message
        > news:e1E_a.5083 $kp4.834536@new s20.bellglobal. com...[color=green]
        > > The problem here is this. If you add your own code to the
        > > InitializeCompo nent and then add a new control to your form or delete a
        > > control from your form, then your code may become deleted. Microsoft
        > > actually warns about it and does not recommend to add your own code to[/color][/color]
        the[color=blue][color=green]
        > > InitializeCompo nent. That's why there is a comment added to it:
        > > /// <summary>
        > >
        > > /// Required method for Designer support - do not modify
        > >
        > > /// the contents of this method with the code editor.
        > >
        > > /// </summary
        > >
        > >
        > > You'll be better off adding your code to the constructor. So, it's not a
        > > bug, it's a feature.
        > >
        > > "Tabo" <kathy_tabo@hot mail.com> wrote in message
        > > news:098f01c362 11$2d77d520$a40 1280a@phx.gbl.. .[color=darkred]
        > > > when i build the project using C#, the code in
        > > > InitializeCompo nent lost sometimes. Is it a bug?? if yes,
        > > > can some method fix it? thanks for help.
        > > >
        > > > Tabo[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        Working...