Hi all i want to add my Column names in a combo box for some purpose But how i will do that because i dont know the number of columns in the table and new column in the table can be added from the application. So the column size is unknown. Any idea plz

Keep an arraylist or some other sort of list of columns.

ArrayList columns = new ArrayList();
columns.Add("column1");

int columnCount = columns.Count;

you can just use

int count =dataGridView1.Columns.Count;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.