AbsoluteNoob
New member
- Joined
- Nov 8, 2014
- Messages
- 1
- Programming Experience
- Beginner
Hello, I am very new to C# and coding in general. I wanted to connect to a commonly used website/webpage: IMDB, Avengers 2 and essentially take some text from that page, store it within a string, and then print that out within a text block.
So I gave it a go, you'll probably cringe but oh well:
I have a button on the mainpage, clicking it opens up a new page with the textblock in it.
I'm using all the default .WPF namespaces and then 'using System.Net; ' as well. What happens is the client (I guess) returns the HTML code and stores that within the downloadedString variable, but this is of course not what I want. How can I say that I need the actual text from the webpage and then if you're feeling extra charitable, how can I specify which text segments I need (probably have to reference HTML or something.) I'll continue looking into this, please don't just spit out some code for me to copy and paste, that's not what I want - I learn nothing from it truly. Instead, if you could point me in the general direction of useful methods etc. For me to use, that'd be great.
Thanks guys, sorry if this post is in the wrong section.
So I gave it a go, you'll probably cringe but oh well:
C#:
private void Button_Click(object sender, RoutedEventArgs e) {
WebClient client = new WebClient();
String downloadedString = client.DownloadString("http://www.imdb.com/title/tt2395427/?ref_=nv_sr_1");
//On button enter, show Window1.
Window1 win1 = new Window1();
win1.Show();
this.Close();
win1.TextBlock1.Text = downloadedString;
}
I have a button on the mainpage, clicking it opens up a new page with the textblock in it.
I'm using all the default .WPF namespaces and then 'using System.Net; ' as well. What happens is the client (I guess) returns the HTML code and stores that within the downloadedString variable, but this is of course not what I want. How can I say that I need the actual text from the webpage and then if you're feeling extra charitable, how can I specify which text segments I need (probably have to reference HTML or something.) I'll continue looking into this, please don't just spit out some code for me to copy and paste, that's not what I want - I learn nothing from it truly. Instead, if you could point me in the general direction of useful methods etc. For me to use, that'd be great.
Thanks guys, sorry if this post is in the wrong section.