Home All Groups Group Topic Archive Search About
Author
17 Aug 2006 6:44 PM
samoore33
Is there a way to check and see if a document exists when an app loads?
The first time the user starts the app, I want it to check and see if
an XML document exists, which it shouldn't. Therefore it will write out
the xml document needed for the app.

Thanks

Author
17 Aug 2006 7:03 PM
sweet_dreams
samoore33 napisal(a):
> Is there a way to check and see if a document exists when an app loads?
> The first time the user starts the app, I want it to check and see if
> an XML document exists, which it shouldn't. Therefore it will write out
> the xml document needed for the app.
>
> Thanks

Hi samoore33,

You can do ity like that:


Dim DocPath As String = "C:\1.xml"
Dim XMlFile As New FileInfo(DocPath)

  If XMlFile.Exists = True Then
            MessageBox.Show("Exists")
  End If

You have to import System.IO namespace

Hope this helps.

Regards,
sweet_dreams
Author
17 Aug 2006 7:22 PM
samoore33
Sweet,

Thanks a lot, I appreciate the help.

samoore33

sweet_dreams wrote:
Show quoteHide quote
> samoore33 napisal(a):
> > Is there a way to check and see if a document exists when an app loads?
> > The first time the user starts the app, I want it to check and see if
> > an XML document exists, which it shouldn't. Therefore it will write out
> > the xml document needed for the app.
> >
> > Thanks
>
> Hi samoore33,
>
> You can do ity like that:
>
>
>  Dim DocPath As String = "C:\1.xml"
>  Dim XMlFile As New FileInfo(DocPath)
>
>   If XMlFile.Exists = True Then
>             MessageBox.Show("Exists")
>   End If
>
> You have to import System.IO namespace
>
> Hope this helps.
>
> Regards,
> sweet_dreams
Author
17 Aug 2006 8:13 PM
Herfried K. Wagner [MVP]
"samoore33" <samoor***@gmail.com> schrieb:
> Is there a way to check and see if a document exists when an app loads?
> The first time the user starts the app, I want it to check and see if
> an XML document exists, which it shouldn't. Therefore it will write out
> the xml document needed for the app.

'System.IO.File.Exists'.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>