Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Sending multiple items to the clipboard?

Sending multiple items to the clipboard?

Scheduled Pinned Locked Moved C#
helpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hi, I am trying to send a list of urls to the clipboard from my app which will be caught by a download manager. I have got it to work with a single url no problem, but when I select multiple items (in a ListView) the app crashes after the first URL has been sent to the clipboard. This is the code I am using; public void mnuDownloadItem_Click(object sender, System.EventArgs e) { // Some variable declarations int i = 0; String sCurrentURL = ""; // This stops it crashing when the listView is empty if (listView1.SelectedItems.Count != 0) { for(i=0; i < listView1.SelectedItems.Count; i++) { sCurrentURL = listView1.SelectedItems[i].Tag.ToString(); Clipboard.SetDataObject(sCurrentURL); } } } Would appreciate any help with this. Thanks Paul Mason

    J 1 Reply Last reply
    0
    • L Lost User

      Hi, I am trying to send a list of urls to the clipboard from my app which will be caught by a download manager. I have got it to work with a single url no problem, but when I select multiple items (in a ListView) the app crashes after the first URL has been sent to the clipboard. This is the code I am using; public void mnuDownloadItem_Click(object sender, System.EventArgs e) { // Some variable declarations int i = 0; String sCurrentURL = ""; // This stops it crashing when the listView is empty if (listView1.SelectedItems.Count != 0) { for(i=0; i < listView1.SelectedItems.Count; i++) { sCurrentURL = listView1.SelectedItems[i].Tag.ToString(); Clipboard.SetDataObject(sCurrentURL); } } } Would appreciate any help with this. Thanks Paul Mason

      J Offline
      J Offline
      James T Johnson
      wrote on last edited by
      #2

      What exception is being thrown? I see nothing wrong with your code as is; so the exception would help diagnose the problem :) James Sonork ID: 100.11138 - Hasaki "My words but a whisper -- your deafness a SHOUT. I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972

      L 1 Reply Last reply
      0
      • J James T Johnson

        What exception is being thrown? I see nothing wrong with your code as is; so the exception would help diagnose the problem :) James Sonork ID: 100.11138 - Hasaki "My words but a whisper -- your deafness a SHOUT. I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Hi, First thanks for the reply! Secondly after some more experimenting I've found it isnt actually my application raising the exception, its external and is in the download manager (Flashget) which is catching the clipboard copies. So Im wondering if its perhaps sending the copies too quickly for Flashget to catch them, would there be any way I can insert a short pause to test that? Im sure its now pasting OK as I checked the last URL on the clipboard against my ListView and it matched. Thanks Again Paul Mason

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups