I wrote an app which produces a few (3 to 5) lines (strings) of output.
As this text should be displayed I copied it into a listBox and it works as intended.
But I'm looking for a possibility to copy the content into the clipboard allowing the user to insert this text snippet into a file.
I can select the whole content with SelectionMode "MultiExtended" but I didn't succeed transferring it into the clipboard.
This looks like a trivial problem but nevertheless I'm stuck.
How can I solve my problem? Should I use another control than listBox for this task?
What I have tried:
See description of the problem.
The relevant part of my code is quite simple:
My code is quite simple:
string[] ncBlocks = new string[geoelements.Length];
for (int i = 0; i < geoelements.Length; i++)
{
geoelements[i].Translate(-schneidenradius, -schneidenradius);
geoelements[i].Mirror(lage == 1 || lage == 4, lage == 1 || lage == 2);
geoelements[i].Translate(abszisseNull, ordinateNull);
ncBlocks[i] = geoelements[i].CreateNCBlock(format);
Console.WriteLine(ncBlocks[i]);
}
listBox1.Items.AddRange(ncBlocks);
The text contained in listBox1 is dsplayed as intended. And if the user wants to transfer this text into a file he should be able to copy and paste it.
Maybe there is an event I could use to write the into the clipboard if the text has been selected?