Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hai
is it possible to drag and drop control from one to another form in run time ?Like in designg time we have to drag and drop controls from tools box,same like i need to create one tools box in that having 10 buttons,and in main form i have to drag the button from tools box and drop in main window,

i can do in same form and code is available in this link Is it possible to drag control from one form to another form in vb.net in visual studio 2012 ?[^]

but i need like desing time how it work same like in run time.

Note: buttons not in same form it will in another form like floating window.


Regards
Aravind
Posted

1 solution

You can copy and paste controls between forms, by highlighting them (either with CTRL and click or drag a box round them) and using CTRL+C and CTRL+V, but I don't think you can drag and drop - it's not something I've really needed or tried.

The problem is that that copies the controls and the properties on the design surface only: it doesn't set any events of copy any code behind them, so the controls as copied will not actually work.

A better approach mch be to create the buttons on a UserControl, and add one of those to both forms - that way it is easy to make any changes to the function of the buttons and it is automatically reflected in both forms. It also helps to keep the size of a form code down to more manageable levels: I do it all the time, and it really helps with getting clean code out!
 
Share this answer
 
Comments
Aravindba 20-Aug-13 3:13am    
Thank for ur reply, i need only buttons drag and drop and only properties only enough to carry form tools box(floating from),no need for functionality like button click event, i need only Text,Tag,Name properties only.is it possible to transfer from one form to another form at run time in windows application using vb.
NOTE: at run time ,not in design time,i need like create a project in windows same like in run time,that is can drag and drop or double click on control and it will placed in form,like that i need run time.
OriginalGriff 20-Aug-13 3:19am    
DON'T SHOUT. It's rude.
Aravindba 20-Aug-13 3:26am    
I am not shout,go to ENT doctor and check ur ear first......
OriginalGriff 20-Aug-13 3:40am    
Do you think that Netiquette does not apply to you?

http://en.wikipedia.org/wiki/Netiquette#Netiquette
Aravindba 20-Aug-13 3:47am    
???? what u say ?
i am just reply ur post,i am not shout ok ? u say can copy and past control from one form to another form , so i ask is it run time or design time ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900