Home All Groups Group Topic Archive Search About
Author
30 Mar 2005 7:15 PM
John
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.

Author
30 Mar 2005 7:39 PM
Crouchie1998
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()
Author
30 Mar 2005 7:56 PM
Herfried K. Wagner [MVP]
"John" <J***@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/>
Author
30 Mar 2005 8:34 PM
Herfried K. Wagner [MVP]
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/>
Author
30 Mar 2005 8:11 PM
John
Solved, thanks.

SaveFileDialog.OverwritePrompt = False

Show quoteHide quote
"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.
>
Author
30 Mar 2005 8:11 PM
Samuel R. Neff
Set the OverwritePrompt property to false.

HTH,

Sam


On Wed, 30 Mar 2005 11:15:07 -0800, "John"
<J***@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.