Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

[VB.NET] Get USD Price of Bitcoin (no JSON)

Hi !

I'm going to share a code made by me for get the official price of Bitcoin
from blockchain.info !

I call :

LBL_Stats_Price a label in my form !

The code :

Code
Public Class Form1
      Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
LBL_Stats_Price.Text = "Price of Bitcoin ( from blockchain.info ) : $" & (GetPrice()) & " USD"
      End Sub

      Function GetPrice() As String
        Dim request As New WebClient
        Return request.DownloadString("https://blockchain.info/fr/q/24hrprice")
      End Function
End Class

That's all !
Bye ! :)
Declare the web client outwith the function so you don't initialize each time the method is called.

Code
Private Function getPrice() As String
    Return String.Format("Price of 1 Bitcoin: ${0} USD", wc.DownloadString("https://blockchain.info/fr/q/24hrprice"))
End Function
This is no better than "no JSON", if anything I'd say it's worse..
(Feb 17, 2015 12:25 PM)DevNet Wrote:  This is no better than "no JSON", if anything I'd say it's worse..

I searched a method for get the price without JSON !
But it's easy with JSON :)


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by roosiinfidel09May 26, 2021 06:32 AM 1 274 May 26, 2021 06:32 AM
Last Post: h0lyl337
[.NET] by outlawNov 28, 2020 04:25 AM 12 367 Nov 28, 2020 04:25 AM
Last Post: Rmdy
[C#] by HardStoNAug 15, 2020 03:56 AM 6 294 Aug 15, 2020 03:56 AM
Last Post: HardStoN