473,782 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SaveFileDialog

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 .CheckFileExist s = False"
in my code, but the warning msg keeps showing up.

Please help, thanks.

Nov 21 '05 #1
5 7890
Don't use the save file dialog & use stream writer

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

sw.WriteLine("Y ou Text Here")

sw.Flush()

sw.Cloase()
Nov 21 '05 #2
"John" <Jo**@discussio ns.microsoft.co m> 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
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 .CheckFileExist s = False"
in my code, but the warning msg keeps showing up.

Please help, thanks.

Nov 21 '05 #4

Set the OverwritePrompt property to false.

HTH,

Sam
On Wed, 30 Mar 2005 11:15:07 -0800, "John"
<Jo**@discussio ns.microsoft.co m> wrote:
In my VB .Net WinForm app, SaveFileDialog gives me an error msg
"C:\MyFile.t xt 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 .CheckFileExist s = 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
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
'OverwritePromp t' 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3453
by: Michael A. Covington | last post by:
I've just determined, by experimenting, that regardless of its Filter and DefaultExt properties, a SaveFileDialog will let you save the file with *any* registered extension. For instance, if you specify a SaveFileDialog with the attributes: AddExtension = true Filter = "Foo files|*.foo" DefaultExt = "foo"
6
19288
by: Ken Allen | last post by:
I have enocuntered something wierd. If I invoke an instance of the above dialog and elect to save the file in a directory where a file of that name does not exist, then the return is DialogResult.OK, but if I elect to save the file on top of a file with the same name in the same directory, when I press the Save button I get a "do you want to overwrite" dialog -- even if I press OK the SaveFileDialog returns DialogResult.Cancel! How...
2
1641
by: Yoshi | last post by:
Hi Everyone! I am using the SaveFileDialog class. I want the user to specify the "SaveAs" filename so I can use that name when creating a text document. Here is my question below. When the SaveFileDialog is displayed, how do you get it to show all the files that have the ".txt" extension? It's only showing me the folders. Thanks,
2
1885
by: Dennis C. Drumm | last post by:
Is there a way for the parent that calls the SaveFileDialog.ShowDialog to consume events associated with this dialog such as LocationChanged, Moved and Closed events? I had been working on a way to customize the SaveFileDialog and on second thought think it might be better to attach a FixedToolWindow dialog to the bottom that contains the two text box controls I need for user input. Thanks,
5
2815
by: juli | last post by:
Hello dear fellows! Is there any chance that you know how can I upload a file with the saveFileDialog control to a specific folder-> I want any file uploaded to be save on specific folder with specific name. Do you know how? Thank you very much!
3
3128
by: josh | last post by:
How do I make it actually save or open a file? It only opens the dialogs. What do I type to get it to save? Here's what I have so far: Public Class frmMainApp Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code "
2
20507
by: ad | last post by:
Hi, I want to use saveFileDialog to save a file (like c:\aa.zip) to another place. How can I assgin c:\aa.zip to saveFileDialog
17
8029
by: Peter Duniho | last post by:
I searched using Google, on the web and in the newsgroups, and found nothing on this topic. Hopefully that means I just don't understand what I'm supposed to be doing here. :) The problem: I am trying to use the SaveFileDialog class to get a filename, which is subsequently opened for writing (write access, read sharing, but using read/write sharing doesn't make the problem go away anyway). Sometimes, on the statement where I...
3
2669
by: =?Utf-8?B?UmljaA==?= | last post by:
I want to create a class library project (dll) for use with a com app. The idea is to use .Net objects in com. I also want to include a SaveFileDialog in the class library. Is it possible to include a SaveFileDialog object in my library project without having to include a form in the project? how to do this? Thanks, Rich
8
11628
by: Joe Duchtel | last post by:
Hello - I have the following code to detemine a file name when my application is saving a file. The problem is that if the file already exists and I select the Yes button in the "Do you want to replace" dialog, the DialogResult is Cancel instead of OK. Is there something I am missing? Dim lSaveFileDialog As New SaveFileDialog
0
9639
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10311
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10146
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9942
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8967
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7492
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5509
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4043
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2874
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.