Hi,
I'm having a strange problem when cancelling changes on a BO with child objects. Whenever I call CancelEdit on the BO, all newly added childs are removed from the child collection (inherits from BusinessListBase), but the modifications to the existing child objects aren't gone.
Any suggestions would be helpfull.
Thx
Bart.
Check out the FAQ and then doa search for more info.
Basically I think your ID values are not unique.
Hi,
Thx for your answer. I already checked the FAQ but doesn't find any info regarding this problem. In fact I don't think it has something to do with the ID value since I'm using Guid's that are generated when the child objects are created.
The problem is that the undo functionality does only half of the job: all newly added child to the BO are rollbacked correctly (in fact deleted), but the problem is that the changes to the already existing child objects aren't rollbacked to the original values...
Am I missing something and do I have to use the CancelEdit in another way or is something wrong with the FWor my BO's ?
Bart.
I guess you’re working with the DataGridView for your child objects, in this case, try the next line before the call to CancelEdit() in your cancel event:
childBindingSource.EndEdit()
I had a similar problem before, and had something to do with the Undo from the data grid (the ESC action) as it is calling to BeginEdit() too.
Ok, to make this as clear as I can. I have a child object that has two buttons (one to cancel changes and another to take the changes) This is a single child object is to remain around (Not close) even though it is hidin. (.Visable = false) Calling the Close without keeping changes button is the following code
mCustomer.CancelEdit()
Me.Visible = False Me.CustomerBindingSource.ResetBindings(False)
Now If I am keeping the changes I call the following code
Me.Visible = False
The Show win part redisplays the information as it was even though I used canceledit() function. And called the cancel edit function prior.The object seems to be still intact with the changes (And I have not destroyed the object) Just calling it up again with the Following:
Private
Sub EditCustomerButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EditCustomerButton.Click ' see if this project is already loaded For Each ctl As Control In ContractEntryEditPanel1.Controls If TypeOf ctl Is CustomerEntry Then Dim part As CustomerEntry = CType(ctl, CustomerEntry)ShowWinPart(part)
Exit Sub End IfNext
This should use the exiting object instead of loading it from the database.
Question is How does the object react without being destoryed and reloaded with the canceledit function?
CancelEdit only seems to work with closeing of the object and does not concider that the object can be cancel changes on the fly and keeped in memory for future referance.
Im thinking that I have to add inital values on the load from database and on initalization, then on canceledit restore these values in the project.libarary if the object is to hang around. Is this the way to go?
I Hope that I explained this right.
Iceman
Thanks, In addtion to that fixing the cancel button how do I tell the object without saving to keep the changes, Because I might bring the object back up then make additional changes that would need to be canceled back to the last keep changes click.
For example text field has "Customer Name"
The user changes this to "Customers Real Name" and then clicks keep changes (We do not save we just hide the entry screen.
Then the user wants to make another change and we redisplay the entryscreen an the user changes the filed to "Customers Real" but then desides not to keep the changes.
Instead of going back to "Customers Real Name" it Goes all the way back to "Customer Name".
Thanks
Copyright (c) Marimer LLC