Created
December 22, 2017 11:14
-
-
Save davlgd/091400e4fc6a9d8088a02e828ee0c02c to your computer and use it in GitHub Desktop.
AlticeStockChecker - Etape 7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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