Skip to content

Data binding of child controls of ToolStripControlHost #6517

Answered by RussKie
hdefucom asked this question in Q&A
Discussion options

You must be logged in to vote

You need to assign a binding context to the hosted control, otherwise a currency manager object isn't created:

if (newDataSource is not null && BindingContext is not null && newDataSource != Convert.DBNull)
{
newDataManager = (CurrencyManager)BindingContext[newDataSource, newDisplayMember.BindingPath];
}
if (_dataManager != newDataManager)
{
if (_dataManager is not null)
{
_dataManager.ItemChanged -= new ItemChangedEventHandler(DataManager_ItemChanged);
_dataManager.PositionChanged -= new EventHandler(DataManager_PositionChanged);

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by RussKie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #6297 on January 18, 2022 07:39.