Binding a BindingList to a DataGridView

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • myotheraccount

    Binding a BindingList to a DataGridView

    I'm a newbie to c#, so bear with me.
    I'm trying to get data into from a DataReader, put it into a
    BindingList that is bound into a DataGridView. My code is:

    BindingList<str ing[]bl = new BindingList<str ing[]>();
    BindingSource bs = new BindingSource() ;
    DataGridView dgv = new DataGridView();

    load_list()// method that loads the list using the DataReader

    bs.DataSource = bl
    dgv.DataSource = bs


    As I debug, I can see that the values in bl are correct (columns are
    "start", "end", "duration") , but the DataGridView shows the following
    columns: Length, LongLength, Rank, SyncRoot, IsReadOnly, IsFixedSize,
    IsSynchronized. Of course all rows have the same value for each of
    the columns.

    What am I doing wrong?

    Let me know if more code is needed.
    Thanks in advance

Working...