For Programmers: Free Programming Magazines  


Home > Archive > Visual Studio > March 2005 > As designed ?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author As designed ?
Leif Eirik Olsen

2005-03-08, 3:59 am

Hi,

I doing my first C# project and have seen that at designtime, copy-paste or
cut-paste of a (ex Button) with a designtime assigned eventhandler, the
eventhandler ref. is not pasted. Is this "as designed" or it is a bug?

Thanks,
Leo


Kevin Spencer

2005-03-08, 4:01 pm

Since the event handler is assigned to a specific Control, and the copy is
not the specific Control it was designed for, it is "by design."

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You S Is What You Get.

"Leif Eirik Olsen" <leif-eirik.olsen@_REMOVE_plugging.com> wrote in message
news:uPXF146IFHA.588@TK2MSFTNGP15.phx.gbl...
> Hi,
>
> I doing my first C# project and have seen that at designtime, copy-paste
> or
> cut-paste of a (ex Button) with a designtime assigned eventhandler, the
> eventhandler ref. is not pasted. Is this "as designed" or it is a bug?
>
> Thanks,
> Leo
>
>



Leif Eirik Olsen

2005-03-09, 4:00 am

"Kevin Spencer" <kevin@DIESPAMMERSDIEtakempis.com> skrev i melding
news:egadil%23IFHA.1528@TK2MSFTNGP09.phx.gbl...
> Since the event handler is assigned to a specific Control, and the copy is
> not the specific Control it was designed for, it is "by design."


Well in my case the copy is of "the specific Control".
Ex. I have a tabcontrol w/10 pages with checkboxes, combos and radiobuttons
on it. All I wanted to do was to use ctrl-x and ctrl-v to move it
(tabcontrol) to a panel for design purposes. After that I have to go through
every control on the tabpage to re-assign all events for the tabcontrol
w/childcontrols. Not very RAD if you ask me.

regards,
Leo


Amit Bahree

2005-03-09, 4:00 pm

Well I would recommend, defining the same control on the different form
(with the same name for the control) and then just open the code and
copy it from there. Copy and Paste the best feature in Windows. :)

If you are not sure where the delegated are defined, then look at the
"Windows Form Designer Generated code" and get all the delegates from
there.

"Leif Eirik Olsen" <leif-eirik.olsen@_REMOVE_plugging.com> wrote in
message news:leif-eirik.olsen@_REMOVE_plugging.com:

> "Kevin Spencer" <kevin@DIESPAMMERSDIEtakempis.com> skrev i melding
> news:egadil%23IFHA.1528@TK2MSFTNGP09.phx.gbl...
>
> Well in my case the copy is of "the specific Control".
> Ex. I have a tabcontrol w/10 pages with checkboxes, combos and radiobuttons
> on it. All I wanted to do was to use ctrl-x and ctrl-v to move it
> (tabcontrol) to a panel for design purposes. After that I have to go through
> every control on the tabpage to re-assign all events for the tabcontrol
> w/childcontrols. Not very RAD if you ask me.
>
> regards,
> Leo


Kevin Spencer

2005-03-09, 4:00 pm

If you want to assign the same event handler to a control, and you're using
Visual Studio.Net, you can find the event in the Control Properties dialog
box, click in it, and a drop-down list of all existing event handlers with
that signature will appear, from which you can select it.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You S Is What You Get.

"Amit Bahree" <amit@_REMOVE_ME_desig.com> wrote in message
news:ObD%23uCNJFHA.688@TK2MSFTNGP10.phx.gbl...
> Well I would recommend, defining the same control on the different form
> (with the same name for the control) and then just open the code and copy
> it from there. Copy and Paste the best feature in Windows. :)
>
> If you are not sure where the delegated are defined, then look at the
> "Windows Form Designer Generated code" and get all the delegates from
> there.
>
> "Leif Eirik Olsen" <leif-eirik.olsen@_REMOVE_plugging.com> wrote in
> message news:leif-eirik.olsen@_REMOVE_plugging.com:
>
>



Leif Eirik Olsen

2005-03-10, 8:58 am

"Kevin Spencer" <kevin@DIESPAMMERSDIEtakempis.com> skrev i melding
news:%23Gj4MtNJFHA.3752@TK2MSFTNGP14.phx.gbl...
> If you want to assign the same event handler to a control, and you're

using
> Visual Studio.Net, you can find the event in the Control Properties dialog

box

Thanks, and yes I know.

Another way could be to alter (with caution) the InitializeComponent() to
put the mentioned tabcontrol onto a panel.
Something like:
this.aContainerPanel.Controls.Add(this.MyTabControl)

regards,
Leo


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com