C# Display a value on a website into a richtextbox

C# Display a value on a website into a richtextbox
0

#1

I’m currently trying to learn C#, and to be honest I’m really liking it. Unfortunatelly I ran into a problem.

I’m working on a program called CryptoChecker. It is composed of two buttons, and a richtextbox. CryptoChecker checks the current bitcoin price and refreshes every 5 seconds, well, at least that’s what I want to do.

This is the website from where I’m getting the price:

https://api.cryptonator.com/api/ticker/btc-usd

I’m making my program on visual studio 2017, and I need help!

here’s my code: HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://api.cryptonator.com/api/ticker/btc-usd"); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); StreamReader sr = new StreamReader(response.GetResponseStream()); richTextBox1.Text = sr.ReadToEnd(); sr.Close();

so what I currently have is: all the values displayed on the richtextbox, but I don’t want that! I want only the price value on the richtextbox. How am I supposed to do it??


#2

Basically you are asking for the data and then just dumping it into the RichTextBox.
To only display the price, you need to filter out the items you don’t want.