Results 1 to 3 of 3

Thread: Bind a DataGridView to a table in Entity Framework

  1. #1

    Thread Starter
    Frenzied Member cory_jackson's Avatar
    Join Date
    Dec 2011
    Location
    Fallbrook, California
    Posts
    1,145

    Bind a DataGridView to a table in Entity Framework

    I am using Entity Framework to work with a simple table. How do I bind a DataGridView to a table?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Bind a DataGridView to a table in Entity Framework

    You don't. You bind to a list of some sort. You query your EF context in an appropriate manner and then call ToList or ToArray on the result to get a generic List or an array, then you bind that to your DataGridView, preferably via a BindingSource. If you want to be able to add and remove items, a List would be the better option.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Frenzied Member cory_jackson's Avatar
    Join Date
    Dec 2011
    Location
    Fallbrook, California
    Posts
    1,145

    Re: Bind a DataGridView to a table in Entity Framework

    Thanks! I'll try that.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width