Sharing one BindingSource.

Sharing one BindingSource.

Post by RGFu » Wed, 05 Apr 2006 01:44:03

What i would like to do is share on datasource with many forms, controls and
etc. but i having a problem, the binding only updates the targets when the
position of the datasource is changed (you will understand that after you see
the code below). so if change the description textbox the other textbox on
the other form wont update. only after i change the selected item in the
listbox. i even trying to use the same bindingcontext on each form but it is
not working. I hope someone can help me achieve this. below you can see an
example that its just like the way i trying.

Xml Data - C:\Data.xml
<description>language-integrated query</description>
<name>C# 3.0</name>
<description>proposed changes to the C# language</description>

FormA ---
Public class FormA
Private DataSet _dataset;
Private Lixbox _list;
Private TextBox _text;

Public FormA(DataSet ds) : this()
This._dataset = ds;

This._list.DataSource = this._dataset.Tables[roject;
This._list.DisplayMember = ame
This._list.ValueMember = ame


private void _list_SelectedItemChanged(object sender, EventArgs e)
this.BindingContext{this._dataset, "Project"].Position =


static Main(string[] args)
DataSet dataset = new DataSet();

BindingContext bin = new BindingContext();

FormA a1 = FormA(dataset);
FormA a2 = FormA(dataset);

a1.BindingContext = bin;
a2.BindingContext = bin;



Sharing one BindingSource.

Post by U3BhcmtQbH » Fri, 26 May 2006 02:42:01


Hi Dan,

Try this method:

Let us know if your problem is fixed.