Live Chat Icon For mobile
Live Chat Icon

How to populate a listbox with the Column Names in a Table

Platform: ASP.NET| Category: ListBox

VB.NET


’Populate the dataset
Dim dc As DataColumn
For Each dc In ds.Tables(0).Columns
	ListBox1.Items.Add(dc.ColumnName)
Next

C#


//Populate the Dataset
foreach (DataColumn dc in ds.Tables[0].Columns)
{
	ListBox1.Items.Add(dc.ColumnName);
}

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.