473,386 Members | 1,720 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,386 software developers and data experts.

saving file

I want to save file ,using the SaveFileDialog control, in such way
that uploaded file will be saved always as "text.txt" and always in
c:\Text folder.
How do I do it?
Thank you a lot and Happy new Year!
Nov 16 '05 #1
7 3201
juli wrote:
I want to save file ,using the SaveFileDialog control, in such way
that uploaded file will be saved always as "text.txt" and always in
c:\Text folder.
How do I do it?


Why do you need a SaveFileDialog when there's no choice?

--
Joerg Jooss
www.joergjooss.de
ne**@joergjooss.de
Nov 16 '05 #2
the C# Version:

string allmytext = "blah blah blah";

SaveFileDialog sfd = new SaveFileDialog();

sfd.FileName = @"c:\text\text.txt";

System.IO.StreamWriter sw = new System.IO.StreamWriter(sfd.OpenFile());

sw.Write(allmytext);

sw.Flush();

sw.Close();

Ciaran

"Joerg Jooss" <jo*********@gmx.net> wrote in message
news:uD**************@tk2msftngp13.phx.gbl...
juli wrote:
I want to save file ,using the SaveFileDialog control, in such way
that uploaded file will be saved always as "text.txt" and always in
c:\Text folder.
How do I do it?


Why do you need a SaveFileDialog when there's no choice?

--
Joerg Jooss
www.joergjooss.de
ne**@joergjooss.de

Nov 16 '05 #3
Ciaran wrote:
the C# Version:

string allmytext = "blah blah blah";

SaveFileDialog sfd = new SaveFileDialog();

sfd.FileName = @"c:\text\text.txt";

System.IO.StreamWriter sw = new
System.IO.StreamWriter(sfd.OpenFile());
sw.Write(allmytext);

sw.Flush();

sw.Close();


But the user can still change the file name and the directory. My point was
that a dialog that leaves you no option is moot ;-)
Cheers,

--
Joerg Jooss
www.joergjooss.de
ne**@joergjooss.de
Nov 16 '05 #4
Joerg,

Read it again. It is BS however fun. It does the same as you wrote.
(There is no sfd.ShowDialog in it)

Cor
the C# Version:

string allmytext = "blah blah blah";

SaveFileDialog sfd = new SaveFileDialog();

sfd.FileName = @"c:\text\text.txt";

System.IO.StreamWriter sw = new
System.IO.StreamWriter(sfd.OpenFile());
sw.Write(allmytext);

sw.Flush();

sw.Close();


But the user can still change the file name and the directory. My point
was that a dialog that leaves you no option is moot ;-)
Cheers,

--
Joerg Jooss
www.joergjooss.de
ne**@joergjooss.de

Nov 16 '05 #5
Cor Ligthert wrote:
Joerg,

Read it again. It is BS however fun. It does the same as you wrote.
(There is no sfd.ShowDialog in it)


Yup, I completely missed that! Now that's a funny way to write a file :-D

Cheers,

--
Joerg Jooss
www.joergjooss.de
ne**@joergjooss.de
Nov 16 '05 #6
psg
"Joerg Jooss" <jo*********@gmx.net> wrote in message
news:ue****************@TK2MSFTNGP14.phx.gbl...
Yup, I completely missed that! Now that's a funny way to write a file :-D


be sure that You have "C:\text\"
otherwise it will rise an exception:
"Additional information: Could not find a part of the path
"c:\text\text.txt"."

RGDS PSG
Nov 16 '05 #7
psg wrote:
"Joerg Jooss" <jo*********@gmx.net> wrote in message
news:ue****************@TK2MSFTNGP14.phx.gbl...
Yup, I completely missed that! Now that's a funny way to write a
file :-D


be sure that You have "C:\text\"
otherwise it will rise an exception:
"Additional information: Could not find a part of the path
"c:\text\text.txt"."


C'mon, use a FileStream and be done with it.

Cheers,
--
Joerg Jooss
www.joergjooss.de
ne**@joergjooss.de
Nov 16 '05 #8

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

Similar topics

7
by: G-Factor | last post by:
Hi all I've just started learning about saving files. I got bit of a problem. The following code gives me an error about incompatible types. (Cannot covert from class character to char *). I...
4
by: dale zhang | last post by:
Hi, I am trying to save and read an image from MS Access DB based on the following article: http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp Right now, I saved images without any...
15
by: Dan DeConinck | last post by:
Hello, I want to save the position of all the controls on my form. I would like to write them out to a preference file. I have done this in DOS BASIC like this: TO WRITE the preference...
5
by: TheGanjaMan | last post by:
Hi everyone, I'm trying to write up a simple image stamper application that stamps the Exif date information from the jpegs that I've taken from my digital camera and saves the new file with the...
4
by: Pedro Leite | last post by:
Good Afternoon. the code below is properly retreiving binary data from a database and saving it. but instead of saving at client machine is saving at the server machine. what is wrong with my...
6
by: Mark Denardo | last post by:
My question is similar to one someone posted a few months back, but I don't see any replies. Basically I want to be able to have users upload photos and save them in a database (as byte data)...
0
by: Speilman_54 | last post by:
Hi, I'm converting an excel Macro into visual basic 2005 express, as I don't have a copy of VB 6 and trying to make and executable from it, I know this version doesn't have the save file as .exe,...
1
by: Allie | last post by:
Hi, all. This might be a silly question... but I am very new to programming in SQL so please bear with me :) So. I'm using MS SQL Server 2005 Management Studio Express. I have a table that...
6
by: Karl | last post by:
Hi all, It may seem like a rather odd request (or not) but I would like to be able to create a file (doc, jpg, xls or one of many other files that can be automated) on a website and stream it to...
6
by: Eddie | last post by:
Hi all, I am displaying a number of reports, and giving the users an option to display them on the web or download them to Excel. If they want the Excel file, I just use the PHP header command...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.