OnAddNew Override QuestionOnAddNew Override Question
Old forum URL: forums.lhotka.net/forums/t/1652.aspx
white911 posted on Wednesday, November 01, 2006
I am overriding the OnAddNew in my Editable Child Collection
Protected Overrides Function OnAddNew() As Object
Dim itm As Child = Child.NewChild(0)
list.Add(itm)
Return itm
End Function
How can I make it work with a grid that it should get the new item from the new line in the grid?
ajj3085 replied on Wednesday, November 01, 2006
Before the list.Add, you'll need to raise the OnAddingNew event.
Also, you'll need to make sure that the collection, the bindingsource, and the grid all have theirAllowNew properties set to true.
HTH
Andy
white911 replied on Wednesday, November 01, 2006
What I want to do is when I enter a item in the new row and press Enter, it should automatically be added to the collection without having to call a function in the business object, how can this be done?
ajj3085 replied on Wednesday, November 01, 2006
If you follow all the steps I have outlined, this is exactly what you'll get.
The grid will handle calling AddNew for you.
Copyright (c) Marimer LLC