By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,285 Members | 1,269 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,285 IT Pros & Developers. It's quick & easy.

SaveFileDialog

P: n/a
In my VB .Net WinForm app, SaveFileDialog gives me an error msg
"C:\MyFile.txt already exists. Do you want to replace it?"

What I need to do is to append something to an existing file, so I want to
avoid this warning msg. I included "SaveFileDialog.CheckFileExists = False"
in my code, but the warning msg keeps showing up.

Please help, thanks.

Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Don't use the save file dialog & use stream writer

Dim sw As New IO.StreamWriter(C:\SomeFile.txt", True)

sw.WriteLine("You Text Here")

sw.Flush()

sw.Cloase()
Nov 21 '05 #2

P: n/a
"John" <Jo**@discussions.microsoft.com> schrieb:
In my VB .Net WinForm app, SaveFileDialog gives me an error msg
"C:\MyFile.txt already exists. Do you want to replace it?"


I am not able to repro this behavior with .NET 1.1, Windows XP Professional
SP2 with a SaveFileDialog placed on a form.

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

Nov 21 '05 #3

P: n/a
Solved, thanks.

SaveFileDialog.OverwritePrompt = False

"John" wrote:
In my VB .Net WinForm app, SaveFileDialog gives me an error msg
"C:\MyFile.txt already exists. Do you want to replace it?"

What I need to do is to append something to an existing file, so I want to
avoid this warning msg. I included "SaveFileDialog.CheckFileExists = False"
in my code, but the warning msg keeps showing up.

Please help, thanks.

Nov 21 '05 #4

P: n/a

Set the OverwritePrompt property to false.

HTH,

Sam
On Wed, 30 Mar 2005 11:15:07 -0800, "John"
<Jo**@discussions.microsoft.com> wrote:
In my VB .Net WinForm app, SaveFileDialog gives me an error msg
"C:\MyFile.txt already exists. Do you want to replace it?"

What I need to do is to append something to an existing file, so I want to
avoid this warning msg. I included "SaveFileDialog.CheckFileExists = False"
in my code, but the warning msg keeps showing up.

Please help, thanks.


B-Line is now hiring one Washington D.C. area VB.NET
developer for WinForms + WebServices position.
Seaking mid to senior level developer. For
information or to apply e-mail resume to
sam_blinex_com.
Nov 21 '05 #5

P: n/a
Errata:
In my VB .Net WinForm app, SaveFileDialog gives me an error msg
"C:\MyFile.txt already exists. Do you want to replace it?"


I am not able to repro this behavior with .NET 1.1, Windows XP
Professional SP2 with a SaveFileDialog placed on a form.


Sorry, I had a bug in my code which leaded to wrong results. The
'OverwritePrompt' property of 'SaveFileDialog' is set to 'True' by default.
By changing its value 'False' prior to showing the dialog the messagebox is
not shown.

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

Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.