Ammar Shaukat

Ammar Shaukat

  • 516
  • 3.8k
  • 686k

How to fetch data from a website and populate it in ComboBox

Oct 16 2015 4:21 PM
I'm working on a desktop application in C# forms.I need this List of Banks in a combobox as drop
down list, like this one.                                                                                                                                           

Currently I've populated the comboBox drop down list myself. But I want to fetch that list from the given link. I'd search on google and found few answers but they are not helping.

I tried to get that data by using following code but I only got some html like contents in result.

System.Net.WebClient wc = new System.Net.WebClient(); string webData = wc.DownloadString("http://www.pakwatan.pk/banks-pakistan/"); 
cbBankName.DataSource = webData.ToList();

I don't know how to extract require contents from following result.

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns="http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>BANKS IN PAKISTAN</title> </head>
 

Brought to you by:

Answers (2)