[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Populate combobox with dataset column names

Posted on 2006-10-25
2
Medium Priority
?
417 Views
Last Modified: 2010-04-16
Hi guys,

I am jumping from vb.net to C# and I am not very familiar with C# but need to force myself to use it.

How can I populate a combobox with a datasets column names?

Usually in vb.net I would do a

for each column in sqldatasource
  dropdownlist.items.add(column.name)
next

Thanks,
Pad
0
Comment
Question by:Paddlefoot
2 Comments
 
LVL 30

Accepted Solution

by:
anarki_jimbel earned 200 total points
ID: 17808292
If you use e.g. DataAdapter with a DataTable, and want to filll a dropdown list with DataTable's column names you do something like:

            //e.g.: DataTable tbl = new DataTable();

            foreach (DataColumn col in tbl.Columns)
            {
                dropdownlist.Items.Add(col.ColumnName);
            }
0
 

Author Comment

by:Paddlefoot
ID: 17808308
Too easy! Thanks anarki.

Pad
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question