I have a base class that implements INotifyPropertyChanged :
protected void OnNotifyChanged(string pName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(pName)); } } public event PropertyChangedEventHandler PropertyChanged;
I have a derived class with the Latitude property as follows:
private double latitude; public double Latitude { get { return latitude; } set { latitude = value; OnNotifyChanged("Latitude"); } }
My derived class also has a Fly method that controls Latitude .
I also have a TextBox form related to the Latitude my derived class:
txtLat.DataBindings.Clear(); txtLat.DataBindings.Add("Text", bindSrc, "Latitude");
The thread is used to launch Fly as follows:
Thread tFly = new Thread(f.Fly); tFly.IsBackground = true; tFly.Start();
When Latitude changes, an exception is thrown:
DataBinding cannot find a row in the list that is suitable for all bindings.
multithreading c # winforms binding
wulfgarpro
source share