Using O/R designer to bind a Windows Form in LINQ

In this post I will show you, how you could bind a Windows Form with Entity created by O/R designer. Essentially we are going to create a DataSource using generated entity of O/R designer.

I assume that,

1. You have created Windows Application project.

2. You have created Datacontext and entity class using LINQ to SQL class. Imagine you have dragged and dropped Person class on O/R designer from School database. Dbml file is looking more or less like below.


Follow the below steps to bind Windows Form,

1. Click on Data from top menu and choose Add New Data Source


2. Select Object as Data Source type


3. Choose Data object. Select Person from listed objects and click Finish


4. Navigate to Windows Form and open design surface and again click on Data in top menu and choose Show Data Sources


5. Now you will get Person in Data Sources listed. Select and drag on design surface.


In bottom of designer you can see Binding Data Source created


6. Now open the code Form class and add below code. Since you know to populate the data you need to set the Data Source of Binding Source as DataContext .


7. To save modification and add new rows , open Properties of Save button from navigation


Then in Properties Windows set Enabled as true.


8. In event of Save button write below code


Press F5 to run the application


Now you should able to perform all the operation.

I hope this post was useful. Thanks for reading Smile

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

3 responses to “Using O/R designer to bind a Windows Form in LINQ”

  1. […] Using O/R designer to bind a Windows Form in LINQ […]

  2. super, that what I’m looking for

  3. Dhananjay Kumar

    glad it was useful

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at