Results 1 to 5 of 5

Thread: [2005] get value from a page, how?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2006
    Posts
    419

    [2005] get value from a page, how?

    hello.

    i have made a converter which is really simple, you can put in a value you want to convert and what the current value of say the £ to the $ is and it will work out, i would like to know how its possible to get a value from a webpage.

    i would like to find out how to get a value from http://uk.finance.yahoo.com/currency-converter you see there is a table which displays the values in the table, my question is how do i get those values from the internet to my application?, is this possible?

    if you know where a good example/tutorial is or can give an example that would be great

    thanks
    lee
    If a post has been usefull then Rate it!

  2. #2
    Addicted Member
    Join Date
    May 2006
    Location
    Manchester, England
    Posts
    255

    Re: [2005] get value from a page, how?

    Have a look at:

    http://msdn2.microsoft.com/en-gb/vbasic/ms789065.aspx

    Microsoft have a tutorial entitled, "Interacting With Web Sites in Code" - which looks as though its pretty much what you need.

  3. #3
    Lively Member Shardox's Avatar
    Join Date
    Nov 2006
    Location
    Barcelona, Spain
    Posts
    123

    Re: [2005] get value from a page, how?

    Hello VBlee,
    I had to do something similar but with EUR-USD, and after experimenting with yahoo financial website I found a way to get the EUR-USD directly in a txt file. I have changed EUR into GBP and ...guess what? It worked!

    Here is the code:


    Code:
            If My.Computer.Network.IsAvailable Then
                Try
                    ' Download file from internet
                    My.Computer.Network.DownloadFile( _
                    "http://finance.yahoo.com/d/quotes.csv?s=GBPUSD=X&f=sl1&e=txt", _
                    "quotes.txt", String.Empty, String.Empty, False, 10000, True)
                    ' Read file and get the value
                    Dim st As String = System.IO.File.ReadAllText("quotes.txt").Trim
                    Dim value As String
                    value = Strings.Right(st, st.Length - st.IndexOf(",") - 1)
                    MsgBox(value)
                Catch ex As Exception
                    ' Timeout
                    MessageBox.Show("Time to get value from internet exceeded", "TIMEOUT")
                End Try
            Else
                'Network is not available
                Messagebox.show("Network is not available","Network Error")
            End If

    Notes:
    I have set timeout to 10000 miliseconds (10 secs).
    You can change the extension of the downloaded file to another one by changing the last 3 characters of the URL.
    To get other rates just change the 6 characters after s=
    Examples: EURUSD,USDEUR,GBPEUR,EURGBP,USDGBP...
    Last edited by Shardox; Apr 24th, 2007 at 12:03 AM.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2006
    Posts
    419

    Re: [2005] get value from a page, how?

    thank you all very much i will have a look at this code and try to work something out
    If a post has been usefull then Rate it!

  5. #5
    Lively Member Shardox's Avatar
    Join Date
    Nov 2006
    Location
    Barcelona, Spain
    Posts
    123

    Re: [2005] get value from a page, how?

    I wrote GPB instead of GBP (Great Britain Pound, I guess). I have corrected it over my first post.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width