Using collection as data object to a DataGrid

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

    Using collection as data object to a DataGrid

    Hi all,

    I had created an Windows Forms project. I have created several struct
    objects (with three fields) and added them to ArrayList collection. Next, I
    tried to use that collection as a data object and assign it to the
    DataSource property of a DataGrid control. Unfortunately, the DataGrid
    control didn't display any data.
    Can you tell me, please, what I did wrong?


  • Joe Mayo

    #2
    Re: Using collection as data object to a DataGrid

    Hi David,

    Wrap the fields with public properties and the properties will bind.

    Joe
    --
    Welcome to C# Station!  This is a community site for people interested in applying .NET using the C# programming language.  We’ve been around since July 4th 2000 and have continued to grow over the years.  Items of interest include Articles, Books, Links, Documentation,  and Tutorials. More… Source Code If you would like to see an […]


    "David K." <kerenshor@013. net.il> wrote in message
    news:uYHDr%23f4 EHA.1192@tk2msf tngp13.phx.gbl. ..[color=blue]
    > Hi all,
    >
    > I had created an Windows Forms project. I have created several struct
    > objects (with three fields) and added them to ArrayList collection. Next,[/color]
    I[color=blue]
    > tried to use that collection as a data object and assign it to the
    > DataSource property of a DataGrid control. Unfortunately, the DataGrid
    > control didn't display any data.
    > Can you tell me, please, what I did wrong?
    >
    >[/color]


    Comment

    Working...