I'm creating an application where I would like the user to be able to change the columns of a DataGridView at runtime.
So far, I've been able to bind the columns to a listbox, in order to list and select the columns individually. However, I can't seem to choose what is displayed in my list box.
I have the following code:
listBoxDataColumns.DataSource = dataGridViewData.Columns;
listBoxDataColumns.DisplayMember = "Name";
My listbox then displays something like:
DataGridViewTextBoxColumn {Name=ID, Index=0 }
DataGridViewTextBoxColumn {Name=Value, Index=1 }
and so on...
How would I display only the Name portion of the column in this list?
Is there an easier way to allow the user to change the columns at runtime? I'm primarily interested in allowing them to add/delete columns, and rename the columns.
Thanks!
Gabe