Hi,
"Steve Marshall" <st****@westnet.net.auwrote in message
news:11*********************@z35g2000cwz.googlegro ups.com...
Yes, an approach like that has occurred to me, and I will pursue it.
It just doesn't seem to fit as naturally as I would like with the way
the IDE does things. Thanks for the reply.
<text snipped>
Here is some addition info:
After compiling the class (example) below, you can create an object Data
Source from it (Data Source's window, add new Data Source). Once you have
the Data Source you can use it with the WinForm designer and the DataTable
will only be loaded once when it's first used.
Imports WindowsApplication1.SomeDBDataSetTableAdapters
Public Class GlobalCompanyDataSource
Implements System.ComponentModel.IListSource
Public Shared _Table As SomeDBDataSet.CompanyDataTable
Public Shared ReadOnly Property Table() As
SomeDBDataSet.CompanyDataTable
Get
If (_Table Is Nothing) Then
_Table = New SomeDBDataSet.CompanyDataTable
Dim cta As New CompanyTableAdapter
cta.Fill(_Table)
cta.Dispose()
End If
Return _Table
End Get
End Property
Public ReadOnly Property ContainsListCollection() As Boolean Implements
System.ComponentModel.IListSource.ContainsListColl ection
Get
Return False
End Get
End Property
Public Function GetList() As System.Collections.IList Implements
System.ComponentModel.IListSource.GetList
Return Table.DefaultView
End Function
End Class
If your form needs to contain global and a non global DataTable's which are
part of the same DataSet, then you could just use the DataSet on the Form
and then replace the fill line in Form_Load for the global DataTable, this
way you can still enforce referential integrity (fk constraints).
Private Sub Form_Load(...)
' fill lookup (global)
SomeDBDataSet.Company.Merge(CompanyGlobalSource.Ta ble)
' fill master (non-global)
EmployeeTableAdapter.Fill(SomeDBDataSet.Employee)
End Sub
HTH,
Greetings