Check if Form Has Been Saved

L

Lee

Hi All,

Is there a way I can check if a form has been saved already?

What I need to do is, if the form has not been saved and the user clicks the
cancel button I want to just exit the form. But if it has been saved onces
then it needs to be re-saved under the old name.

Thanks

Lee
 
S

Scott L. Heim [MSFT]

Hi Lee,

There may be other ways to accomplish what you need; however, this may work
for you. When you first double-click an XSN file to create a new document,
the form is named "Form1" and if you execute the following code on, say, a
button click the only thing it returns is "Form1."

XDocument.URI

However, if the form had been previously saved, the above code would return
the complete path to the form. As such, if the forms were to be stored
locally or on a network share, what you could do would be to check for the
existence of the backslash ("\") and if it exists, you know the form had
been previously saved.

Just a thought...

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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

Top