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. Check clipboard for a URL

Check clipboard for a URL

Scheduled Pinned Locked Moved C#
question
3 Posts 3 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.
  • J Offline
    J Offline
    Jassim Rahma
    wrote on last edited by
    #1

    I want to know how can I check if the clipboard has a URL or not? basically I have a txtURL textbox on my form and I want if they user went to any browser or word editor to copy a URL from there then came back o the same form it should display a MessageBox saying dio you want to copy the URL in the textbox?

    A E 2 Replies Last reply
    0
    • J Jassim Rahma

      I want to know how can I check if the clipboard has a URL or not? basically I have a txtURL textbox on my form and I want if they user went to any browser or word editor to copy a URL from there then came back o the same form it should display a MessageBox saying dio you want to copy the URL in the textbox?

      A Offline
      A Offline
      AspDotNetDev
      wrote on last edited by
      #2

      Yeah, just check if the text in the clipboard is a valid URL. I don't believe there is a specific format for URL's when copied to the clipboard (i.e., they will just be copied as text). Actually, the way the clipboard works is that items can be copied to the clipboard in their various formats. So, the URL might exist as both text and as, say, HTML in the clipboard. If you really want to know, give it a try... handle some event that inspects the clipboard and see what formats are in it, then see what data is contained in each format.

      [Forum Guidelines]

      1 Reply Last reply
      0
      • J Jassim Rahma

        I want to know how can I check if the clipboard has a URL or not? basically I have a txtURL textbox on my form and I want if they user went to any browser or word editor to copy a URL from there then came back o the same form it should display a MessageBox saying dio you want to copy the URL in the textbox?

        E Offline
        E Offline
        Eslam Afifi
        wrote on last edited by
        #3

        Get the text from the Clipboard using the GetText method then match it against a URL regular expression.

        Eslam Afifi

        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