Hi, i have two forms and im having problems sharing the binding source between the two.
I am using custom business objects, and in the designer set form one's binding source's data source to my business object type in the data sources window. The designer then places the code in the form:
m_BindingSource.DataSource = typeof(MyObject);
I then can setup my DataGridView.DataSource = m_BindingSource;
In my constructor i would then set the m_BindingSource.Datasource = new BindingList<MyObject>();
Everything all works well. Then i would make a second form, and create a second binding source as before so i can select which fields i want to show on that form (for arguments sake lets say i am making a details form). I then set the control bindings up as per the first form, and set a property on that form which allows me to set the binding source called BindingSource.
So, from my form1 constructor,
Form1()
{
InitializeComponent();
m_BindingSource.Datasource = new BindingList<MyObject>();
Form2 form2 = new Form2();
form2.BindingSource = BindingSource;
form2.Show();
}
The trouble is i can tell the two forms arent linked as nothing updates when i navigate through the dataset from form1!. One thing i have found is if i set the BindingSource in Form2's BindingSource property, then do manual binding by hand, it works? It is almost like i need to force all controls to rebind.
Any ideas? I would like to stick with using the designer, and be able to link binding sources at will, i dont want to hand code!
Thanks in advance,
Chris