|
-
August 11th, 2003, 02:46 AM
#1
DataTable columns
Is there a way, which I'm sure there is, whereby I can create the number of columns of a DataTable at runtime? I have an ArrayList with the columns that I wish to have, but the size of the ArrayList is only known at runtime.
Btw, thanx to andy_tacker and bfarley for their help on the resizing issues. The Anchor technique worked a treat. Got some getting used to.
Best regards
John
Ask a question and you're a fool for three minutes;
do not ask a question and you're a fool for the rest of your life.
- Chinese Proverb
-
June 30th, 2004, 06:08 AM
#2
Try something like this (where list is your ArrayList):
DataTable dt = new DataTable();
for(int i = 0; i < list.Count; i++) {
dt.Columns.Add("" + i);
}
(""+ i) is an example for your column name. Here it is the index of the data in the arraylist.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|