Click to See Complete Forum and Search --> : Weird behaviour of VS.NET


cyberpilgrim
05-25-2004, 09:52 AM
I create ASP.NET application.

codebehind file contain following area:

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
...
}


I add events handlers there manually. But every once in a while VS.NET review this region and erase my lines :eek:
The questions are: :confused:
1. Is this really a result of VS.NET activity?
2. If yes then how can I change behaviour of VS.NET?
3. If not then can anybody explain me what is going on?

thanking you in anticipation

CardboardHammer
05-25-2004, 10:23 AM
"do not modify the contents of this method with the code editor"

Why do you insist on doing what they told you NOT to do?

To answer 1 and 3: My guess it that something is being done elsewhere to the page (perhaps adding components to it) that causes this code to be rewritten automatically to account for the changes. It probably just does an overwrite of the code, hence the warning not to do any changes to it yourself, lest they be wiped out at a later point.

gayathri_gopi
06-17-2004, 07:54 AM
The erase activity might be due to RAM problem.
I have also faced with this problem.
I think u have only 128KB RAM.
Add one more 64KB.
it will be ok.i hope so.

nemaroller
06-29-2004, 08:22 AM
CardboardHammer had it right. The visual ide will change that code on a whim, has nothing to do with ram.

There are two parts to the page you need to be aware of.

InitializeComponent <- DO NOT MODIFY

Page_Init <- HERE YOU CAN PUT YOUR HANDLERS


Page_Init actually calls InitializeComponent (doesn't show visibly sometimes, because it does so by default), so insert your handlers after that call inside the Page_Init event.