Copy control question

  • Thread starter Thread starter Woody Splawn
  • Start date Start date
W

Woody Splawn

I seem to remember that you can copy a control, like a textbox AND any code
associated with it to another form. Is this true. If so, how? When I
select a textbox, for example in form and, copy it and paste it to another
form, the control shows up but not any code in any of it's events.

Is my memory wrong?
 
* "Woody Splawn said:
I seem to remember that you can copy a control, like a textbox AND any code
associated with it to another form. Is this true. If so, how? When I
select a textbox, for example in form and, copy it and paste it to another
form, the control shows up but not any code in any of it's events.

AFAIS this doesn't work.
 
Hi Woody,

Thank you for using MSDN newsgroup.

I agree with Herfried's suggestion.
Based on my experience, you can copy a control but NOT the event handler
function.

Some properties of controls will be copied. e.g, for TextBox , when you set
the Text property of the textbox in the property page, and you copy the
textbox to another form the text property will also be copied.

If you have any concern on this issue ,please post here.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
I seem to remember some subtle difference with regard to copy, cut and
delete, that one of them allowed you to transfer not only the control but
the code behind it. However, I recognized that my memory is not what it
could be. Thank you for responding.
 
Hi Woody,

As I said in my last post, the copy-paste or cut-paste will transfer some
properties of a control( e.g. the text property of textbox) but not all
(e.g. the Databings-Text property).

If you want to make another form reuse the control on the form. You may try
to use the Visual Inherited.
You can inherited a form from the original one.

Here is helpful link, you may take a look.
Walkthrough: Demonstrating Visual Inheritance
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
vbwlkwalkthroughdemonstratingvisualinheritance.asp

If you have any concern on this issue ,please post here.

Best regards,

Perter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Woody.

Did my answer help you?
if you have any concern on this issue,please post here.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top