Tech Off Post

Single Post Permalink

View Thread: Dynamically adding the text box value to the xml file
  • User profile image
    Dr Herbie

    Is there a reason you're not using a data structure and binding the contents of the data structure to the controls? 

    For example, I would create a class called Address, with properties for all the details like CountryName, CountryCode, etc.  On the form I would create an instance of this structure and bind it's content to the relevant controls.  Then when it needs to save to XML you can simply serialize the data structure.

    For more complex scenarios you end up with a full Controller/ViewModel containing all the code and the logic, while the form simply uses data binding to display the data to the user.