Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

C# Programming

How to remove automatic generated lines in Form.Designer.cs refering non-existing objects ?


Assume the following sequence of user actions starting with a Form and an e.g. StatusStrip:

1.) User doubleclicks on the StatusStrip
2.) VisualStudio jumps to the new generated source code

mystatusstrip_itemClicked() { ..... }

3.) The user deletes this function from source code (because he decide not to add such an event)
4.) "Rebuild of source code"
5.) An error appears:

    mynamespace.Form1 does not contain a defintion for "mystatsustrip_itemClicked"

Obvisouly the DoubleClick inserts not only a function in the user source code but also
a reference in the Form1.Designer code.

How do I let VS 2005 automatically remove (resp. synchronize) not existing
function calls in Form1.Designer code ?

Mark

On May 30, 1:15 pm, m.popp@lycos.com (Mark Poppers) wrote:

In the designer right click on the status strip and choose properties.
In the property grid click on the events button (the lightning bolt).
Find the ItemClicked event.
Clear the text from beside it.

Now the form should comile.

-----------------------------------------------Reply-----------------------------------------------

Hi,

"Mark Poppers" <m.popp@lycos.com> wrote in message

news:465d6ad5$0$20283$9b4e6d93@newsspool3.arcor-online.net...

> How do I let VS 2005 automatically remove (resp. synchronize) not existing
> function calls in Form1.Designer code ?

There is no automatic way that I know of if you just remove the method from
the code.
Under that escenario you have two options:
1- compile the project, it will show the error, you just simply remove the
offending line in the designer.cs code and recompile
2- in the design view, select the control, go to properties, events and
clear the event you do not want to fire.

Now I might be wrong but I'm using Infragistics controls lately and I have
the impression that they do remove the event assignment if you modify the
code, not 100% sure though. I will open that project later today and will
let you konw.

-----------------------------------------------Reply-----------------------------------------------

On Wed, 30 May 2007 07:21:05 -0700, Ignacio Machin ( .NET/ C# MVP )  

<machin TA <"laceupsolutions.com>"> wrote:
> [...]
> Now I might be wrong but I'm using Infragistics controls lately and I  
> have
> the impression that they do remove the event assignment if you modify the
> code, not 100% sure though. I will open that project later today and will
> let you konw.

I have, inexplicably, seen both behaviors in the VS designer.  I have  
definitely had trouble some times though where I delete the method, then  
delete the event, but the assignment in the Designer.cs file remains.  :(  
I'm pretty sure I've also seen it allow me to delete the event handler  
after the fact and not get messed up.

However, if the method is empty and you remove it from the event in the  
designer, all is good.  It's removed from the event, from the Designer.cs  
code *and* the method itself is deleted from the source file for you.

Pete

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc