Button for saving, and code that goes with it... - InfoPath Dev
in

InfoPath Dev

Button for saving, and code that goes with it...

Last post 06-21-2008 09:16 PM by Hilary Stoupa. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-11-2008 06:37 AM

    Button for saving, and code that goes with it...

    ..I'm making a form, and I would like to have a button that would allow me to save the form locally, after it is filled out. What would be the code/procedure/attributes on the button for something like this? I appreciate any help, thanks.

     --gsempcb
     

  • 06-21-2008 09:16 PM In reply to

    Re: Button for saving, and code that goes with it...

    Hello:

    If you haven't already set your preferred code language for the form, you may want to do that first (in InfoPath 2007, go to Tools, Form Options, Programming). After you add your button to your form, double click it, and give it a Label and a meaningful ID. Then select the Edit Form Code button. VSTA will open and you can add code to the event handler for the button. In C#, the following line will save a form locally, with the name TestForm.xml:

    this.SaveAs("C:\\TestForm.xml");

    You will probably want to add some error handling, and it would make sense to give your forms a name that will be unique, so that you aren't overwriting the previously saved form with your new one (unless that is your desired effect). For more information on the XmlForm.SaveAs method, see this link: http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.xmlform.saveas.aspx

    Hilary Stoupa

    Filed under: ,
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.