Martin Spedding's Blog

Adventures in a disconnected world

Trouble with winforms - am I missing something ?

I decided that I would spruce up my winforms app and use the Magic user interface  library(http://www.dotnetmagic.com/). I decided the best way to do it was to create a temp form and then cut all the controls off the form I was going to change add the new controls and then paste back the controls that I had pasted in the temp form. Everything went well and all the event procedures were still in the form but of course the controls were no longer with their associated with event procedures. Which meant I had to rewire the whole form. But even more annoying than that, if I go to the events pane of the properties sheet for the control and clicked on the appropriate event to create the delegate it did not create a delegate for cboDay_TextChanged  but for  cboDay_TextChanged_1

I was wondering if I am missing something  or how other people deal with this problem ? It really is a pain. I know I could write a Visual Studio macro to deal with the problem but it would help if Visual Studio was a little bit more intelligent in the way in which it wired up events and controls.

Any ideas ?

Comments

Medve said:

Hi Martin!

It could happen that i misunderstood your troubles, but as far as i know you could simply drop down the matching delegates by each method and select the one you need. So do not double-click for create, but drop down and select for assignment.

Medve
# March 28, 2003 12:02 AM

Martin Spedding said:

Hi,

thanks for the comment. I had forgotten about the drop down box but really the problem is not with the rewiring logic.It is more a problem that when I cut out a set of controls and then paste them back into a form the designer should be clever enough to rewire the form or at least give me that option. When you have a large number of controls it is a time consuming process.

Thanks

Martin
# March 28, 2003 12:37 AM

Marc said:

Please excuse me if I misread your post but it sounds like you are trying to take an existing WinForm and duplicate it in another form. The fastest way to do this is to open the first WinForm in code view, select everything, past that code into the code view of the new window.

Because VS exposes all of the code that builds that window, you no longer need to copy & past the visual objects.
# March 28, 2003 1:20 AM

karen said:

Fantastic
# February 22, 2004 6:54 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)