DesignTime binding!!

Posts   
 
    
omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 21-Dec-2004 15:12:10   

Greetings, I have the following senario: 1- Entity MW that has on child collection MWDetails 2- screen that displays fields of MW and MWDetails in a grid

I followed the instructions (as layed out in the Help) to add the generated DAL dll to the toolbox and from there I started binding the text boxes to MW fields and the grid to MW.MWDetails. When the screen loads up I load the collection as so

        Dim adapter As DataAccessAdapter = New DataAccessAdapter
        Dim col As EntityCollection = New EntityCollection(New MWFactory)

        adapter.FetchEntityCollection(col, aFilterBucket, MyPrefetchPath())

        If Not m_cManager Is Nothing Then
            RemoveHandler m_cManager.PositionChanged, AddressOf CManager_PositionChanged
            m_cManager = Nothing
        End If

        m_cManager = CType(Me.BindingContext(col), CurrencyManager)
        AddHandler m_cManager.PositionChanged, AddressOf CManager_PositionChanged

I don't get any data displayed in the UI controls although debugging through code I could see the (col) does get filled with the data (and my navigation code changes m_cManager.position as per the navigation button I press). I don't know what I am missing here cry I had this thing working when I was binding and Unbinding manually (as in LLBL's Northwind samples) but I thought that design-time binding could save me time and some typing. I still hope I can get this working since this is a big conveniance saving frowning

OMAR

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 21-Dec-2004 16:29:22   

Design time databinding does define an entitycollection in the form. VS.NET sets up code which binds THAT instance to the grid. So you should either:

1) fill a new collection and simply bind that to the grid or 2) fill the collection you dragged onto the form (which is likely called entityCollection1 )

Frans Bouma | Lead developer LLBLGen Pro