Bind DLINQ to DataGridView
This morning I try to find a method to bind DLINQ to DataGridView. There don’t have ToBindingList in DLINQ DataQuery. Need to manually import System.Data.Dlinq.DataQueryExtensions in the top of form
Imports System.Data.Dlinq.DataQueryExtensions
After that, the method ToBindingList() will come out.
Dim sConnectString As String = "data source=.\SQLEXPRESS;" & _
"Integrated Security=SSPI;AttachDBFilename=D:\Data\Northwind.mdf;" & _
"User Instance=true"
Dim db As New Northwind(sConnectString)
Dim cust = From c In db.Customers _
Select c
DataGridView1.DataSource = cust.ToBindingList()
DataGridView1.Refresh()
So now, I can modify this to bind the DataQuery to BindingSource for my form.