StrataFrame Forum

totally annoying IDE stuff in VB.NET

http://forum.strataframe.net/Topic5415.aspx

By Keith Chisarik - 12/19/2006

I have ignored this until now. I hope for the love of God that I am missing a setting somewhere and this is not the way things are in the .NET world.



When I cut a button (or other control) that has code in one of its events and add it to another container on the form, the new control has no code, the code is stranded up in an event tied to the old (non-existent button).



Also, if I rename a control this happens as well, what a pain.



Here is hoping I am just missing the obvious, in VFP I could cut 40 controls and paste them into a pageframe page (panel page) if I wanted to and everything moved. I tend to focus on "make it work", then go back and make it pretty (and fix control names).



Thanks.


By Trent L. Taylor - 12/19/2006

When I cut a button (or other control) that has code in one of its events and add it to another container on the form, the new control has no code, the code is stranded up in an event tied to the old (non-existent button).

This is actually correct.  It is not like VFP where the code is stored within a control.  All .NET events are properly handled versus executing an embedded procedure as in VFP.  This is actually better because in VFP if you moved a control to another parent or page, then your references died.  As you have learned, this doesn't happen in .NET.  The code is just a handler of the objects events.

Also, if I rename a control this happens as well, what a pain.

It sounds like you are doing this the hard way.  .NET is AWESOME in this respect!!!  Instead of manually renaming a variable or method, right-click the method and select "Rename..."  This will rename the variable, method, etc. and all references to the old name.  Very nice.