Skip to content

Instantly share code, notes, and snippets.

@davlgd
Created December 22, 2017 11:14
Show Gist options
  • Save davlgd/091400e4fc6a9d8088a02e828ee0c02c to your computer and use it in GitHub Desktop.
Save davlgd/091400e4fc6a9d8088a02e828ee0c02c to your computer and use it in GitHub Desktop.
AlticeStockChecker - Etape 7
public Form1()
{
InitializeComponent();
this.Text = Application.ProductName;
GetAndCleanStockValue();
}
private void timer1_Tick(object sender, System.EventArgs e)
{
GetAndCleanStockValue();
}
private void GetAndCleanStockValue()
{
string webPageCode = string.Empty;
using (WebClient wc = new WebClient())
{
webPageCode = wc.DownloadString("https://finance.yahoo.com/quote/ATC.AS?p=ATC.AS");
}
string rawStock = Regex.Match(webPageCode,
"currentPrice\":{\"raw\":(.+?),",
RegexOptions.Singleline).Groups[1].Value;
lblStock.Text = rawStock;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment