I'm trying to have my program "rip" news off of a website and place it on the WinForm, but my method is so dumb and redundant, I'm sure there must be a better way to do it.
public void LoadLatestNews()
{
WebClient TheWebClient = new WebClient();
string SourceCode = TheWebClient.DownloadString("http://www.chronic-domination.com/");
int NewsPosition = SourceCode.IndexOf("news_post-title");
string Y = SourceCode.Substring(NewsPosition,5000);
int TitlePosition = Y.IndexOf("</div");
string NewsPostTitle = SourceCode.Substring((NewsPosition + 17), (TitlePosition - 17));
int BodyPosition = Y.IndexOf("news_post-body");
string X = Y.Substring(BodyPosition, 1000);
int EndBodyPosition = X.IndexOf("<br><br>");
string NewsPostBody = X.Substring((BodyPosition + 16)+ EndBodyPosition);
MessageBox.Show(NewsPostTitle);
}
Not only is this code horrible, it doesn't even work as intended. So I beg you, teach me the proper way to do things like this?