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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Problem with listing the URLs from html source code

Problem with listing the URLs from html source code

Scheduled Pinned Locked Moved Visual Basic
databasehelpcsharphtml
12 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.
  • A Offline
    A Offline
    Aaron128
    wrote on last edited by
    #1

    Hello, I am trying to list all the URLs from a RichTextBox containing source code from a web page. They need to be stored in an SQL or Access database. I am using Visual Basic.NET and i need some help, please. Thanks :-D

    Aaron

    S 1 Reply Last reply
    0
    • A Aaron128

      Hello, I am trying to list all the URLs from a RichTextBox containing source code from a web page. They need to be stored in an SQL or Access database. I am using Visual Basic.NET and i need some help, please. Thanks :-D

      Aaron

      S Offline
      S Offline
      Stephen McGuire
      wrote on last edited by
      #2

      Easiest way would be to cut/paste them yourself... You want to create a function that strips URL's from web page source code? Are you sure that is legal/ethical? Steve

      A 1 Reply Last reply
      0
      • S Stephen McGuire

        Easiest way would be to cut/paste them yourself... You want to create a function that strips URL's from web page source code? Are you sure that is legal/ethical? Steve

        A Offline
        A Offline
        Aaron128
        wrote on last edited by
        #3

        I don't know Steve, but I'm trying to write a search engine and need a program to index hyperlinks into a database, Google did it. I would much appreciate any help though, thanks. :laugh:

        Aaron

        S 1 Reply Last reply
        0
        • A Aaron128

          I don't know Steve, but I'm trying to write a search engine and need a program to index hyperlinks into a database, Google did it. I would much appreciate any help though, thanks. :laugh:

          Aaron

          S Offline
          S Offline
          Stephen McGuire
          wrote on last edited by
          #4

          Ok. You may want to have a look at the Split function using 'space' as the delimiter. You could put each word into an Array or ArrayList. Loop the Array/ArrayList and look for words beginning 'http' or containing 'www' using the InStr function or something similar. Steve

          A 1 Reply Last reply
          0
          • S Stephen McGuire

            Ok. You may want to have a look at the Split function using 'space' as the delimiter. You could put each word into an Array or ArrayList. Loop the Array/ArrayList and look for words beginning 'http' or containing 'www' using the InStr function or something similar. Steve

            A Offline
            A Offline
            Aaron128
            wrote on last edited by
            #5

            OK, I will give it a go. Thanks;)

            Aaron

            S 1 Reply Last reply
            0
            • A Aaron128

              OK, I will give it a go. Thanks;)

              Aaron

              S Offline
              S Offline
              Stephen McGuire
              wrote on last edited by
              #6

              You may want to find the first instance of a URL before assigning anything to your array. Just to keep the array size down. You will probably need to use an ArrayList since it's capacity will increase dynamically and you don't know what the size will be. You should probably strip as much out as you can before populating your ArrayList. Steve

              A 1 Reply Last reply
              0
              • S Stephen McGuire

                You may want to find the first instance of a URL before assigning anything to your array. Just to keep the array size down. You will probably need to use an ArrayList since it's capacity will increase dynamically and you don't know what the size will be. You should probably strip as much out as you can before populating your ArrayList. Steve

                A Offline
                A Offline
                Aaron128
                wrote on last edited by
                #7

                Sorry if I'm being a bit annoying but, I was just wondering if it would be easier to use RichTextBox1.DetectURLs, because I have no idea on how to use the ArrayList, I'm not the best at VB.NET in the world:laugh: But I'm trying. Thanks though

                Aaron

                S 1 Reply Last reply
                0
                • A Aaron128

                  Sorry if I'm being a bit annoying but, I was just wondering if it would be easier to use RichTextBox1.DetectURLs, because I have no idea on how to use the ArrayList, I'm not the best at VB.NET in the world:laugh: But I'm trying. Thanks though

                  Aaron

                  S Offline
                  S Offline
                  Stephen McGuire
                  wrote on last edited by
                  #8

                  Nice idea but I'm afraid that is a property not a method. Its purpose is to automatically format a Uniform Resource Locator (URL) when it is typed into the control. Steve

                  A 1 Reply Last reply
                  0
                  • S Stephen McGuire

                    Nice idea but I'm afraid that is a property not a method. Its purpose is to automatically format a Uniform Resource Locator (URL) when it is typed into the control. Steve

                    A Offline
                    A Offline
                    Aaron128
                    wrote on last edited by
                    #9

                    I think I will try again with your idea, thanks;)

                    Aaron

                    S 1 Reply Last reply
                    0
                    • A Aaron128

                      I think I will try again with your idea, thanks;)

                      Aaron

                      S Offline
                      S Offline
                      Stephen McGuire
                      wrote on last edited by
                      #10

                      Look up the Split function in your help file. You will see an example of how to split a string into an Array or ArrayList. Get the data from the textbox into a string (strip out unwanted text at beginning). Then split it into an array. Loop each item in the array to see if it contains 'www', if it does, add it to your DataSet or write it to your database. That would be a start. Then you can play with it to make it more efficient. Steve

                      A 1 Reply Last reply
                      0
                      • S Stephen McGuire

                        Look up the Split function in your help file. You will see an example of how to split a string into an Array or ArrayList. Get the data from the textbox into a string (strip out unwanted text at beginning). Then split it into an array. Loop each item in the array to see if it contains 'www', if it does, add it to your DataSet or write it to your database. That would be a start. Then you can play with it to make it more efficient. Steve

                        A Offline
                        A Offline
                        Aaron128
                        wrote on last edited by
                        #11

                        Thanks, your help is much appreciated, thanks, it looks like you have helped a lot of people to day, Well Done!! Thanks again:-D

                        Aaron

                        S 1 Reply Last reply
                        0
                        • A Aaron128

                          Thanks, your help is much appreciated, thanks, it looks like you have helped a lot of people to day, Well Done!! Thanks again:-D

                          Aaron

                          S Offline
                          S Offline
                          Stephen McGuire
                          wrote on last edited by
                          #12

                          You're welcome!:cool:

                          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