BBS issue


Author
Message
Keith Chisarik
Keith Chisarik
StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
Scenario:

DataGridView with BBS as its datasource, BBS BO set to a BO on my form. All works fine when DataGridView is on the form. If I move the datagridview into a container (ThemedContainer) and it no longer syncs.

Why and how to fix please?

Keith Chisarik
StrataFrame Team
S
StrataFrame Developer (3.1K reputation)StrataFrame Developer (3.1K reputation)StrataFrame Developer (3.1K reputation)StrataFrame Developer (3.1K reputation)StrataFrame Developer (3.1K reputation)StrataFrame Developer (3.1K reputation)StrataFrame Developer (3.1K reputation)StrataFrame Developer (3.1K reputation)StrataFrame Developer (3.1K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Ok, Keith, I finally got this one figured out.  Something, I have no idea what, is accessing the BindingContext of the ThemedContainer in the setup and loading of the form before the form's BindingContext is created, so the ThemedContainer just creates its own BindingContext.  Any other control on the form that doesn't have its own BindingContext uses its parent's, which cascades up to the form's BindingContext.  The BindingContext is the object that creates the CurrencyManager, which controls the currently selected item.  So, by having the DataGridView in a ThemedContainer, it is using a different CurrencyManager because it has a different BindingContext.

Luckily for us, BindingContext is not read-only Smile

So, adding the following line of code right after the InitializeComponent() call in the constructor fixes it.

public Form1()
{
   InitializeComponent();
   this.themedContainer1.BindingContext = this.BindingContext; //<-- This line sets the BindingContext of the ThemedContainer back to the BindingContext of the form
}

That should get you fixed.
Keith Chisarik
Keith Chisarik
StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)StrataFrame VIP (1K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
That worked, thanks.

Keith Chisarik
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search