populate a dataset from a list

hi guys,
i have a list with a number of strings..
i wish to display those values on on a datagridview.
what method shall i use?im struggling to pass the string list to a dataset.

thanks
// code i've got so far
                clsListClass myFileToSend;
                clsDataBase cls = new clsDataBase();
                myFileToSend = cls.GetData(No);                
 
                foreach (string myString in myFileToSend.Names)
                {                    
                    
                }

Open in new window

LVL 6
zell71Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
You don't need to create a DataSet, in order to bind a list of objects to a DataGridView.  Your objects just need to have public properties which you can specify in the column's DataPropertyName.
0
zell71Author Commented:

clsListClass myFileToSend;
                clsDataBase cls = new clsDataBase();
                myFileToSend = cls.GetData(No);  
                
                // creating new dataset and datatable
                DataSet dsResults = new DataSet();
                DataTable dsTable = dsResults.Tables.Add();
                dsTable.Columns.Add("Purchase Order No", typeof(string));
 
                foreach (string myString in myFileToSend.Names)
                {   
                    // add data into custom created dataset
                    dsTable.Rows.Add(myPOHeaderID);
                }

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bob LearnedCommented:
Does that work, or is that what you were using that has problems?  Did you define columns for the DataGridView, and set the DataSource property to 'dsTable'?
0
zell71Author Commented:
I created a dataset with a datatable and passed my list values into that dataset.my question was to ask how I did but I found the answer
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.