Copy/Paste multiple objects

  • Thread starter Thread starter Greg
  • Start date Start date
G

Greg

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 paste them into another form.

Your help is much appriciated. Thanks in advance,
Greg.
 
Greg said:
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 paste them into another form.

Your help is much appriciated. Thanks in advance,

just select controls with mouse (with help of CTRL - one by one), then
Edit->Copy (or CTRL+C), go to a destination form and Edit->Paste (or CTRL+V)
..... like in a word processor

PZDR PSG
 
Thanks for your reply but this is not what I ment.
I'm writing an application that creates window forms (something like the
VS.NET form designer) and I want to be able to do the copy and pasting via
code.

Cheers,
Greg.
 
Lebesgue,

Thanks for your reply but the examples mentioned in the link you sent me are
using single objects.
I want to be able to copy mulptiple objects i.e. 2 textboxes and 3 dropdowns
and then be able to retrieve them from clipboard.

Thanks anyway,
Greg.
 
How about putting a wrapper object containing all the controls you need into
the clipboard?
 
How about putting a wrapper object containing all the controls you need into
the clipboard?

Would I be able to store them in a HashTable and store that into the
Clipboard?
If I could do that then I should be able to retrive the HashTable from the
Clipboard and then the controls within it.
 
It doesn't work. It seems that I cannot copy/paste a single textbox let
alone multiple textboxes.
Here is the example I used for a single text box:

Clipboard.SetDataObject(textBox2);
IDataObject iData = Clipboard.GetDataObject();
TextBox newTextBox = (TextBox)iData.GetData(DataFormats.Serializable);

textBox2 exists already on the form.

What is returned by GetData is a null reference.

Please help....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top