You can access the selected items in a ListBox via the SelectedItems property. What do you want to do with the data? If your purpose is to make the data available for pasting elsewhere then you can use the Clipboard class to actually copy the data to the Windows Clipboard. If you just want to put it somewhere in your app then go ahead and put it there. If you want to make it appear to the user as though standard Windows Clipboard functionality is being used then you can handle the KeyDown event and test for Ctrl+C and then copy the data to the Clipboard.
Thanks, I want to have the selected items in the clipboard (Ctrl +c?) for using outside the program and to paste elsewhere.
But how to program to make Ctrl+c available?
As I said, handle the KeyDown event of the ListBox, detect the key combination, get the SelectedItems and copy them using the Clipboard. Now that you know the steps, it's time to break out your search skills and research them.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.