Home » FAQ » ASP.NET » ListBox » How to populate a listbox with the Column Names in a Table
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); }
Platform BlazorASP.NETWinFormsWPF.NET MAUI
Question *
Answer (Optional)
Email (Optional)
Email address is only for further clarification on your FAQ request. It will not be used for any other purpose.
Please leave this field empty.
Share with