---
title: "How to populate records in ComboBox"  
description: "To populate ComboBox we have to add the values of DataRows to it"  
author: "Anonymous User"  
published: 2010-08-01  
updated: 2020-03-17  
canonical: https://www.mindstick.com/articles/74/how-to-populate-records-in-combobox  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# How to populate records in ComboBox

To populate ComboBox we have to add the values of DataRows to it.\

##### Example

```
//connecting to database and copying record to DataAdapterstring strConnection = "Server=abc\\SQLEXPRESs;Database=Employee;Trusted_Connection=True";            SqlConnection con = new SqlConnection(strConnection);            con.Open();            SqlDataAdapter da = new SqlDataAdapter("select * from employee", con);            DataSet ds = new DataSet();            da.Fill(ds, "Employee");            DataTable dt = ds.Tables["Employee"];            DataRow row; //populating combobox.             for (int i = 0; i < dt.Rows.Count; i++)            { //this will run for all rows present in table.                                              row = dt.Rows[i]; //adding items to combobox one by one.                cbID.Items.Add(row[0].ToString());            }
```

\

![How to populate records in ComboBox](https://www.mindstick.com/mindstickarticle/8160e747-e6c8-455f-84b2-8954aee0a5fb/images/48037819-943c-4503-ba98-410254dd794b.png)

\

---

Original Source: https://www.mindstick.com/articles/74/how-to-populate-records-in-combobox

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
