User Interface Question - Adding New ChildUser Interface Question - Adding New Child
Old forum URL: forums.lhotka.net/forums/t/1759.aspx
white911 posted on Tuesday, November 14, 2006
I have a parent Object Customer which has a collection of Addresses. In the UI I have a screen for Editing a customer, with a grid of addresses bound to the collection. I have a button Add New Address which opens up a screen to enter a new address, with save and cancel buttons.
I am confused how to write the code for inserting a new address and cancelling if the user cancelled.
Bayu replied on Tuesday, November 14, 2006
If your BO derives from BusinessBase, then it should have CancelEdit and ApplyEdit members just for this purpose ....
Does this answer your question?
Otherwise, could you perhaps be more specific?
Regards,
Bayu
white911 replied on Tuesday, November 14, 2006
I am referring to the User Interface code
On the main Screen How do I call the child screen with a new object and when the user saves how do I get it back into the main screen Object
Bayu replied on Tuesday, November 14, 2006
Alright,
This is somewhat off-topic I guess ...
I believe that something you could do is like the following:
- set some property on your buttons of the child screen that associate a particular DialogResult value with the butotn (eg DialogResult.OK or DialogResult.Cancel).
- (optionally) set the childform's AcceptButton and CancelButton properties
- in your parent screen (main screen), display the child form using the childForm.ShowDialog function
- this will return a DialogResult, the value returned will match the particular property value of the button that was clicked
If you need the newly added BO in your main screen, then your childscreen would need to provide a means to your main screen to access the BO after it was saved. Perhaps using a property?
If you need further assistance then I would foreward you to
one of these MSDN forums.
Regards,
Bayu
Copyright (c) Marimer LLC