Passing values from a Form to a Controller class

  • Thread starter Thread starter Bill Gower
  • Start date Start date
B

Bill Gower

I have a controller class that creates an object and then calls a form for
the user to fill in some information that will populate the object with
after the form is closed. What is the best way for the controller to get
the data the user entered into the form. Should the controller pass the
object to the form and let the form in the save button assign the text box
fields to the object properties or should the form expose public properties
which the controller can call after the form returns and then the controller
populates the object properties? Or is there a better way to do it?

Bill
 
Bill Gower said:
I have a controller class that creates an object and then calls a form for
the user to fill in some information that will populate the object with
after the form is closed. What is the best way for the controller to get
the data the user entered into the form. Should the controller pass the
object to the form and let the form in the save button assign the text box
fields to the object properties or should the form expose public properties
which the controller can call after the form returns and then the
controller populates the object properties? Or is there a better way to do
it?

The object should be independent of who is using it. It should be passed
between the two, with each class working with the object as needed and
independently.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top