private void pcr_oyun_Click(object sender, EventArgs e) { flp_liste.Controls.Clear(); usr_oyun usrListe = new usr_oyun(); LinkOyun("http://mustafauzun0.16mb.com/OYUN/", flp_liste, usrListe); }
void LinkOyun(string htmlLink, FlowLayoutPanel flp, UserControl usr) { string htmlVeri; using (WebClient client = new WebClient()) { client.Encoding = Encoding.UTF8; htmlVeri = client.DownloadString(htmlLink); } Regex r = new Regex(@"<a.*?href=(""|')(?<href>.*?)(""|').*?>(?<value>.*?)</a>"); for (int i = 1; i < r.Matches(htmlVeri).Count; i++) { usr = new usr_oyun(); string[] isim = r.Matches(htmlVeri)[i].Groups["value"].Value.Split('.'); for (int x = 0; x < isim.Length - 1; x++) { ((usr_oyun)usr).lbl_ad.Text += isim[x]; } ((usr_oyun)usr).link = r.Matches(htmlVeri)[i].Groups["href"].Value; flp.Controls.Add(usr); } }