Read local .txt file on app startup

0
0

Howdy,

I need a feature/a way to achieve this, that is, when the app loads, aka, when someone open’s it on the browser, read the .txt file that is in bin/

How could i achieve this?
It’s the same behavior i have in windows apps, that in the sub main(), i just do this below.
What i need is to read this file that is a XML, that has server information.

Thanks in advanced,

#############
Dim ds As New DataSet
ds.ReadXml(“server.xml”)
server_host = ds.Tables(0).Rows(0)(“host”)
server_port = ds.Tables(0).Rows(0)(“port”)
ds.Dispose()
ds = Nothing

  • You must to post comments
0
0

Perfect!

Thanks!!

  • You must to post comments
0
0

Hi Jorge

I’ve attached a sample that hopefully would suite your needs.

You have to make sure to set the “Copy To Output Directory” property of the XML file to copy always.

Also, the Application class has the StartupPath Property that returns the full path to your application’s project folder.

Best regards,
Alaa

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.