473,322 Members | 1,614 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

finding a file in a console app

I'm writing a console app and want to read an XML file that will be in the
same directory as my .exe file. If I were in a web app I could do:

Dim xtr As New XmlTextReader(server.mappath("myfile.xml"))

but I don't know how to find the path in a console app.

thanks,

G
Nov 20 '05 #1
3 2228
how about
Application.ExecutablePath

HTH

Shane

"G. Dean Blake" <De**@nospam.com> wrote in message
news:O$**************@tk2msftngp13.phx.gbl...
I'm writing a console app and want to read an XML file that will be in the
same directory as my .exe file. If I were in a web app I could do:

Dim xtr As New XmlTextReader(server.mappath("myfile.xml"))

but I don't know how to find the path in a console app.

thanks,

G

Nov 20 '05 #2
The Application class is a Windows.forms class. I's not available in a
console application.

no?
G
"SStory" <Th*******@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote in message
news:Os*************@TK2MSFTNGP11.phx.gbl...
how about
Application.ExecutablePath

HTH

Shane

"G. Dean Blake" <De**@nospam.com> wrote in message
news:O$**************@tk2msftngp13.phx.gbl...
I'm writing a console app and want to read an XML file that will be in the same directory as my .exe file. If I were in a web app I could do:

Dim xtr As New XmlTextReader(server.mappath("myfile.xml"))

but I don't know how to find the path in a console app.

thanks,

G


Nov 20 '05 #3
well one way to do it is might be

".\whatever"

I have used that in apps and seems to work.

let me know.
"G. Dean Blake" <De**@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
The Application class is a Windows.forms class. I's not available in a
console application.

no?
G
"SStory" <Th*******@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote in message
news:Os*************@TK2MSFTNGP11.phx.gbl...
how about
Application.ExecutablePath

HTH

Shane

"G. Dean Blake" <De**@nospam.com> wrote in message
news:O$**************@tk2msftngp13.phx.gbl...
I'm writing a console app and want to read an XML file that will be in the same directory as my .exe file. If I were in a web app I could do:

Dim xtr As New XmlTextReader(server.mappath("myfile.xml"))

but I don't know how to find the path in a console app.

thanks,

G



Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: pekspro | last post by:
I need some code that gets the address from a server. I read somewhere that you could do this by starting some broadcast server using UDP. The client should send an broadcast message, and when the...
6
by: John Sedlak | last post by:
Hello, in one of my pages I have an include: <!--#include file="console.aspx" --> Now...Inside console.aspx, I want to be able to find the name of the page that included it. This is because I...
2
by: Thomas Müller | last post by:
Hi, I need a way to find the names of the computers that are reachable over a network. Ideally when it is executed it should report back wich computernames are present. I have seen one...
6
by: Tor Inge Rislaa | last post by:
Finding current Procedure I want to write errors to a log-file, where the error log contain the description of where the error occurred and what kind of error it was. Private Sub...
6
by: Don | last post by:
I'm having problems working with a streamwriter object. After closing the streamwriter and setting it to Nothing, I try to delete the file it was writing to, but I always get the following error...
2
by: Extremest | last post by:
Here is the code I have so far. It connects to a db and grabs headers. It then sorts them into groups and then puts all the complete ones into another table. Problem I am having is that for some...
1
by: randy1200 | last post by:
The following is straight out of the msdn, except where I put in if (reader.Name == "wx") What I'm trying to do is print the word Inner along with the tag name and value for any tag that's a...
6
by: begum | last post by:
HI everybody; I have problem about selecting files in my main file. I have to find the files whose ending INF. What Can I do?Can anybody help me? using System; using...
12
by: Jeff | last post by:
As I'm learning PHP, I'm making a fair number of mistakes in syntax. In perl, you can turn on reading these errors from the browser by adding this: use CGI::Carp 'fatalsToBrowser'; Is there...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.