By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,660 Members | 1,215 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,660 IT Pros & Developers. It's quick & easy.

Form based editing ?

P: n/a
Hello,

What is the best way to implement a form based editing?
The user would select first from a list control (highlighted selection) ?
e.g. through a listbox or datagrid. Then, select from buttons: [New],
[Edit], [Delete]. When editButton is clicked, a form will be displayed for
editing.
How would I populate the form edit window? By setting each field. e.g.
fieldA.text = "value", fieldB.text, etc. Or is there something like DataGrid
control displayed as form ?
Thanks for any help.
Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
If I understand you correctly, you want to build a classic maintenance
form, where the user can edit the individual fields of the selected
item.

If this is so, then in answer to your question, no there is (currently)
no way to auto-populate the individual controls that hold the value of
each field. You have to populate them one by one, as you pointed out.

That said, you should encapsulate this process by having the form
and/or panel that contains the individual controls export a property
for the business object being edited / created.

Setting the property stores the business object in the form / panel and
copies the properties of the business object into the individual
controls.

Getting the property builds a new business object from the contents of
the individual controls.

That way, callers to your form can just create a new form and say
something like:

form1.Customer = ...

and all of the fields will be set up. SImilarly, when the user clicks
"OK", the caller can say:

Customer changedCustomer = form1.Customer;

to get the changes.

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.