473,407 Members | 2,306 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,407 software developers and data experts.

Save Text file to "My Documents"

Ben
Hello,

I need to save some information into a text file.
For this, I use :

FileOpen(1, "c:\MyFile.txt", OpenMode.Output)
For I = 0 To iCpt - 1
WriteLine(1, myDs.Tables(0).Rows(I).Item("MyText"))
Next
FileClose(1)

This is running...

BUT I would like to save the text file into "My Documents" of user whos run
application.
--> In place of : FileOpen(1, "c:\MyFile.txt", OpenMode.Output)
--> I would like : FileOpen(1,"c:\Documents and settings\[USER]\My
Documents", OpenMode.Output)

How know ?

Thanks

Ben
Nov 20 '05 #1
4 6535
Ben,

try

Environment.GetFolderPath(Environment.SpecialFolde r.Personal)

to get that path.

Klaus

"Ben" <be*******@hotmail.com> schrieb im Newsbeitrag
news:ev**************@TK2MSFTNGP10.phx.gbl...
Hello,

I need to save some information into a text file.
For this, I use :

FileOpen(1, "c:\MyFile.txt", OpenMode.Output)
For I = 0 To iCpt - 1
WriteLine(1, myDs.Tables(0).Rows(I).Item("MyText"))
Next
FileClose(1)

This is running...

BUT I would like to save the text file into "My Documents" of user whos run application.
--> In place of : FileOpen(1, "c:\MyFile.txt", OpenMode.Output)
--> I would like : FileOpen(1,"c:\Documents and settings\[USER]\My
Documents", OpenMode.Output)

How know ?

Thanks

Ben

Nov 20 '05 #2
"Ben" <be*******@hotmail.com> schrieb
Hello,

I need to save some information into a text file.
For this, I use :

FileOpen(1, "c:\MyFile.txt", OpenMode.Output)
For I = 0 To iCpt - 1
WriteLine(1, myDs.Tables(0).Rows(I).Item("MyText"))
Next
FileClose(1)

This is running...

BUT I would like to save the text file into "My Documents" of user
whos run application.
--> In place of : FileOpen(1, "c:\MyFile.txt", OpenMode.Output)
--> I would like : FileOpen(1,"c:\Documents and settings\[USER]\My
Documents", OpenMode.Output)

How know ?


dim Dirname, fullname as string

Dirname = Environment.GetFolderPath( _
Environment.SpecialFolder.Personal _
)

fullname = io.path.combine(dirname, "myfile.txt")
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
Nov 20 '05 #3
Hi Ben
BUT I would like to save the text file into "My Documents" of user whos run application.


dim Myfolder as string =
Environment.GetFolderPath(Environment.SpecialFolde r.Personal)

I hope this helps?

Cor
Nov 20 '05 #4
Ben
THANKS !!!

It's running...

"Armin Zingler" <az*******@freenet.de> a écrit dans le message de news:
40***********************@news.freenet.de...
"Ben" <be*******@hotmail.com> schrieb
Hello,

I need to save some information into a text file.
For this, I use :

FileOpen(1, "c:\MyFile.txt", OpenMode.Output)
For I = 0 To iCpt - 1
WriteLine(1, myDs.Tables(0).Rows(I).Item("MyText"))
Next
FileClose(1)

This is running...

BUT I would like to save the text file into "My Documents" of user
whos run application.
--> In place of : FileOpen(1, "c:\MyFile.txt", OpenMode.Output)
--> I would like : FileOpen(1,"c:\Documents and settings\[USER]\My
Documents", OpenMode.Output)

How know ?


dim Dirname, fullname as string

Dirname = Environment.GetFolderPath( _
Environment.SpecialFolder.Personal _
)

fullname = io.path.combine(dirname, "myfile.txt")
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5

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

Similar topics

33
by: Jim Hill | last post by:
I've done some Googling around on this and it seems like creating a here document is a bit tricky with Python. Trivial via triple-quoted strings if there's no need for variable interpolation but...
0
by: Grant_S | last post by:
I need to identify the path to a users "My Document" folder where the user has a roaming profile and their "My Documents" folder is mapped to a network share as the H drive (specifically H:\\ -...
1
by: jj | last post by:
How do I programatically default the encoding of my "Notepad" into ANSI. My application uses notepad to save some text. Some of the client computers have UTF as the default encoding in their...
6
by: JuLiE Dxer | last post by:
Is there a way via C# to programmatically retrieve the full path name to folders like "My Documents" ?? I'm seeing examples with the use of Shell32 stuff I believe, SHGetSpecialFolderLocation...
8
by: Tony Nelson | last post by:
On *nix, ~/foo refers to a file in a user's home directory. On MSWindows, users normally look at "My Documents" in their home directory. ISTM that a file that my program would put in ~/. on Linux...
1
by: Jeremy | last post by:
I don't know if this is really a javascript question but thought I may as well start here... I know that a "document" is what is displayed in a browser window. However it is possible for the...
42
by: Martin Jørgensen | last post by:
Hi, I'm trying to move a matlab program into c language. For those who knows matlab, this is the line I want to program in c: hx(1:nx,1:ny) = 0; % nx=10, ny=10 It works on a 2-dimensional...
4
by: Franky | last post by:
I know about GetModuleFileName but what I need is a similar call to get the folder "My Documents" Is there such a thing? Thanks
3
by: Jack | last post by:
Hi there, In a submit button event, I need to open a (server-side) file relative to the folder containing the ".aspx" file. What's the correct way to locate the ".aspx" folder itself inside my...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.