473,508 Members | 2,292 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CUTand PASTE controls: where is the code?

teo
When I Cut and Paste controls

(ie: from a 'Form' to a 'Tab control'
that I just put on the Form)

the pasted controls regularly arrive with their properties,
but the code behind them
remains ouside the form,
like user written subs remain

infact,
if I double-click on a pasted control
the displayed routine is empty
and now it is called
button_click_1
and not
button_click

is there a way to have the code of a pasted control
regularly "bound" to the pasted control?

Jan 18 '07 #1
3 1591

teo wrote:
When I Cut and Paste controls

(ie: from a 'Form' to a 'Tab control'
that I just put on the Form)

the pasted controls regularly arrive with their properties,
but the code behind them
remains ouside the form,
like user written subs remain

infact,
if I double-click on a pasted control
the displayed routine is empty
and now it is called
button_click_1
and not
button_click

is there a way to have the code of a pasted control
regularly "bound" to the pasted control?
I don't think this is possible.

Jan 18 '07 #2
from what I have seen ... this is what happens me ...when you cut and paste
a control on a form ...

assume Button1 is the control you want to move...

before cut ... u have
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

when control is cut...
- ide goes to the code and removes all the event handles associated to the
control....
- so the following is what appears

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)

- the handles part of the sub is GONE!
- i assume it does this for you so there is no compilation errors...

when the control is pasted...
- the IDE does not automatically set the handles to the 'pasted' control
So, as I said, this is was appears to happen to me whenever I move a control
from one object to another ... ie form to tab page. To avoid this, what I
do is ... copy the control to the tab-page ... go to the code page ... find
and replace old name with new name ... Button1 with Button2 ... delete the
origional control and rename the new control to the origional control...
sounds flaky but it worked when I need it to. This is an arguement / reason
for manually wiring up your events to your controls ...

Again, this is what I experienced, this may or may be the same as your
problem.

"teo" <te*@inwind.itwrote in message
news:ct********************************@4ax.com...
When I Cut and Paste controls

(ie: from a 'Form' to a 'Tab control'
that I just put on the Form)

the pasted controls regularly arrive with their properties,
but the code behind them
remains ouside the form,
like user written subs remain

infact,
if I double-click on a pasted control
the displayed routine is empty
and now it is called
button_click_1
and not
button_click

is there a way to have the code of a pasted control
regularly "bound" to the pasted control?

Jan 19 '07 #3
Yeah I've seen that too...

When you copy and paste a control WITHOUT deleting the original, then
the event handler for the original also becomes the handler for the
pasted control. I find this especially annoying with buttons.

Jan 19 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
10070
by: Dennis C. Drumm | last post by:
Is there a way to modify the standard context menu shown when someone right clicks in a windows text box and that would work for all open windows applications? The standard context menu for...
2
2898
by: Greg | last post by:
Hi all, Is there a way to copy multiple objects into the clipboard and then paste them? What I want to achive is to be able to copy UI controls (textedits, dropdowns, etc) from one form and...
4
4046
by: Bogosian | last post by:
I am working on an asp.net project.There is a subdir called OSearch,with a few aspx pages in it which as all other pages on the website use some controls.These controls are stored in a another...
0
1134
by: Gianluca | last post by:
Hi All, i'm experencing a frustrating and strange behaviaour : I created a Windows project in VB.NET 2003 with a form and then I added a TabControl on the form, and added 5 TabPages on...
7
11600
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
6
9618
by: Ben R. | last post by:
Hi, I've got a vb.net winforms app. Out of the box, I can use Ctrl X, C and V as expected in controls like textboxes. I've got a menustrip, and if I click the link "Add standard items" which...
0
1114
by: Ian Hannah | last post by:
We have implemented our own IDE which is based on an example from Microsoft. We have implemented the IDesignerSerializationService interface in our application. The following steps cause a...
0
1152
by: Beemer Biker | last post by:
I finally discoved why controls are not getting pasted into my multiview "view". The position attribute (absolute, normal, offset) is being set to absolute. I assume this is a "feature" of the...
11
9624
by: John | last post by:
Hi In a winform app I need to provide a menu with Cut, Copy and Paste options., What code do I use to accomplish cut, copy and paste features for fields on a winfrom? Thanks Regards
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5050
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1553
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.