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. Web Development
  3. ASP.NET
  4. find all images id from html file and store in array in c#

find all images id from html file and store in array in c#

Scheduled Pinned Locked Moved ASP.NET
csharphtmldata-structureshelp
4 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.
  • V Offline
    V Offline
    vnsraj
    wrote on last edited by
    #1

    Hi All, I have html file, I want to find out all images and their ids from html file and store all images id in array. Please need your help... Thanks Rajesh

    C V L 3 Replies Last reply
    0
    • V vnsraj

      Hi All, I have html file, I want to find out all images and their ids from html file and store all images id in array. Please need your help... Thanks Rajesh

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You could use regular expressions to do this.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      1 Reply Last reply
      0
      • V vnsraj

        Hi All, I have html file, I want to find out all images and their ids from html file and store all images id in array. Please need your help... Thanks Rajesh

        V Offline
        V Offline
        vnsraj
        wrote on last edited by
        #3

        Thanks for reply but if you have example code, so please provide me.

        1 Reply Last reply
        0
        • V vnsraj

          Hi All, I have html file, I want to find out all images and their ids from html file and store all images id in array. Please need your help... Thanks Rajesh

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

          Use the WebBrowser control that comes with .NET. You can use the WebBrowser.Document.Images collection to get the list of image tags in the html page.

          WebBrowse1.Navigate("c:\mypage.html");

          List<string> images = new List<string>();

          HtmlElementCollection elements = WebBrowser1.Document.Images;

          foreach(HtmlElement e in elements) {
          images.Add(e.Attributes("id");
          }

          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