How Populate Data in a ComboBox Using XML File And C#
Submitted by janobe on Wednesday, June 5, 2019 - 22:15.
In this tutorial, I will teach you how to populate data in a combobox using XML File and C#. This method has the ability to display the data from the XML file to a combobox. Hope this tutorial will help you with your current problem in programming. Just follow the instructions below.
Create an XML File named “country”.
Write the following codes for adding the content in the XML FIle.
The complete source code is included you can download it and run it on your computer.
For any questions about this article. You can contact me @
Email – [email protected]
Mobile No. – 09305235027 – TNT
Or feel free to comment below.
Creating XML File
Go to the solution explorer, right click the resources file and add new item.

- <NewDataSet>
- <Table>
- <abbr>BEF</abbr>
- <Description>Belgium Francs</Description>
- </Table>
- <Table>
- <abbr>DEM</abbr>
- <Description>Germany Deutsche Marks</Description>
- </Table>
- <Table>
- <abbr>ESP</abbr>
- <Description>Spain Pesetas</Description>
- </Table>
- <Table>
- <abbr>FRF</abbr>
- <Description>France Francs</Description>
- </Table>
- </NewDataSet>
Creating Application
Step 1
Open Microsoft Visual Studio 2015 and create a new windows form application for c#.
Step 2
Do the form just like shown below.
Step 3
Press F7 to open the code editor. In the code editor, add a namespace to access theResources File
.
- using LoadDataXML.Properties;
Step 4
Create a method for filling the xml data inside the combobox.Step 5
Write the following code to execute the method that you have created in the first load of the form.- private void Form1_Load(object sender, EventArgs e)
- {
- LoadCountry(comboBox1);
- }
Add new comment
- 863 views