Custom DataBinding
I need of a help with Custom DataBinding
I'd created 3 Persistent objects
- CVObject (Business Object Base)
- CVObjectCollection (Collection of CVObject)
Implements ICollectionBase, IBindingList
- CVDataSource (DataSource to my Business Object)
Implements IListSource
GetList returns a CVObjectCollection
In CVDataSource, I have a method called Append()
these method create my CVObject instance and set a flag(isAddNew) to true, calling BeginEdit(), and adding my object in CVObjectCollection.
private CVObjectCollection objectsList;public void Append()
{
object obj = Activator.CreateInstance(ObjectType, new object[] {true});
_currentIndex = (objectsList as IList).Add(obj);
(obj as IEditableObject).BeginEdit();
}
I have in CVDataSource too the method Save():
public void Save()
{
CVObject obj = (CVObject)listaObjetos[_currentIndex];
(obj as IEditableObject).EndEdit();
}
The Binding is working perfectly, but I would like of implement a custom save method to my CVObject. In my forms I have two TextBoxes Control (txtCode, txtDescription) and two Buttons Control (btnNew, btnSave). private void btnNew_Click(object sender, System.EventArgs e) private void btnSave_Click(object sender, System.EventArgs e) What I wanna to do is following: The problem: When I call the Append() method the object, it's added correctly to collection, but the binding controls do not receive the new object. Someone can help me? Leo
Example:
{
this.myDataSource.Append();
}
{
this.myDataSource.Save();
}
First: When CVDataSource to call the Append() method, to create a new object and to grant to the TextBoxes new values, as such as, blank values.
Second: When CVDataSource to call the Save() method, to save new object updated to BD.
I searched in internet by google and too in msdn library but, I not found some implementation to .NET Framework 1.1 version. I readed about PropertyChanged but, it is only in Framework 2.0, and the others implementations that I found, say to handle a Custom PropertyChanged in each Business Class derived from CVObject, but I dont wanna to do thus. I would like of use the Business Class just to mapping and to centre anything in my Base Object (CVObject), including the Custom PropertyChanged...

