Getting OnLoaded to Fire

Getting OnLoaded to Fire

Postby larrydhunt » Wed 18 Feb 2009 16:10

I have a question about the partial OnLoaded method. I am using the sample project:
C:\Program Files\Devart\dotConnect\Linq\Samples\MySQL\VBasicLinqDemo.sln

OnLoaded fires when a DataGridView is used, i.e.:
C:\Program Files\Devart\dotConnect\Linq\Samples\MySQL\VB\Queries\MainForm.vb
Code: Select all
dataGridView.DataSource = query.Query

However, if I try to convert a query to an Array the OnLoaded doesn't fire.
Code: Select all
crmDataContext = New CrmDataContext.CrmDataContext(connectionString)
Dim query = From Company In crmDataContext.Companies Select Company.CompanyID, Company.City
Dim anArray As Array = query.ToArray

What do I need to do to get OnLoaded to fire? Note; I think this also happens with MS LINQ to SQL.

Posts: 10
Joined: Tue 20 Jan 2009 21:40

Postby AndreyR » Wed 25 Feb 2009 08:39

The problem is that you are loading only a subset of Company properties, not the Company object itself. No method should fire in this situation.
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Return to LinqConnect (LINQ to SQL support)