• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

  • 0
Sign in to follow this  

Why does this code run like hell? Populate DataGridView with LINQ


Kalint    228

Partial Form Code

// Form Load
private void FrmBuildersManageLoad(object sender, EventArgs e)
// Controller
LstBuilders.MultiSelect = false;
LstBuilders.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
LstBuilders.DataSource = Accessor.DisplayBuilders();

Partial Accessor Code

public class BuildersResults
public string Builder { get; set; }
public string Address { get; set; }
public string City { get; set; }
public string State { get; set; }
public string Zip { get; set; }
public string PhoneNumber { get; set; }
public string FaxNumber { get; set; }
public string EmailAddress { get; set; }

// Get Full Table of Builders
public static List<BuildersResults> DisplayBuilders()
var dataConnect = new PxLinqSqlDataContext();

return (from b in dataConnect.GetTable<TblBuilders>()
select new BuildersResults
Builder = b.Contact,
Address = b.Address,
City = b.City,
EmailAddress = b.EmailAddress,
FaxNumber = b.FaxNumber,
PhoneNumber = b.PhoneNumber,
State = b.State,
Zip = b.Zip

Share this post

Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.