473,473 Members | 2,134 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Save as dialog

5 New Member
Hi

I'm new to vb 2005 and am having problems with save as dialog code, when i go to save a file it returns "file not found" but when it looks at a file on the pc then it will save,
can someone help & tell me whats missing?? i have listed the code below

Expand|Select|Wrap|Line Numbers
  1. Dim iResult As DialogResult
  2.         iResult = SaveFileDialog1.ShowDialog()
  3.         SaveFileDialog1.Title = "Specify a Name for the File"
  4.         SaveFileDialog1.Filter = "Text Format (*.txt) | *.txt"
  5.         SaveFileDialog1.AddExtension = True
  6.         SaveFileDialog1.OverwritePrompt = True
  7.         SaveFileDialog1.InitialDirectory = "C:\"
  8.         SaveFileDialog1.FileName = ""
  9.         If iResult <> Windows.Forms.DialogResult.Cancel And SaveFileDialog1.FileName.Length <> 0 Then
  10.             F3mainreport.SaveFile(SaveFileDialog1.FileName)
  11.          End If
Many Thanks
Feb 7 '07 #1
6 2637
willakawill
1,646 Top Contributor
A quick look at your code and I think you may want to open the save dialog after you have set the properties

Expand|Select|Wrap|Line Numbers
  1. Dim iResult As DialogResult
  2.  
  3.         SaveFileDialog1.Title = "Specify a Name for the File"
  4.         SaveFileDialog1.Filter = "Text Format (*.txt) | *.txt"
  5.         SaveFileDialog1.AddExtension = True
  6.         SaveFileDialog1.OverwritePrompt = True
  7.         SaveFileDialog1.InitialDirectory = "C:\"
  8.         SaveFileDialog1.FileName = ""
  9.         iResult = SaveFileDialog1.ShowDialog()
  10.         If iResult <> Windows.Forms.DialogResult.Cancel And SaveFileDialog1.FileName.Length <> 0 Then
  11.             F3mainreport.SaveFile(SaveFileDialog1.FileName)
  12.          End If
Feb 7 '07 #2
wheeto
5 New Member
Thanks for the help,
I have changed the code and i still get up the message box

"File C:\testfile does not exist"
"Verify that the correct file name was given"

If i select a file the exists, it will over write the file, not create a new one.

I have tried changing the code around, but with no luck,
I have searched the internet for answers, but have drawn a blank.
I can normaly find an answer that can help with other problems, but not this one.
Feb 7 '07 #3
willakawill
1,646 Top Contributor
At what point in your code does this error come up?
Is it when you call the save for your report?
Feb 7 '07 #4
wheeto
5 New Member
At what point in your code does this error come up?
Is it when you call the save for your report?

The problem is when i build & test the program, i can create a report in my program then try to save the text box with the save as commard, the error then appears.It is as if i have left out a piece of code that tells the system to create a new file if its not already present.
Feb 7 '07 #5
willakawill
1,646 Top Contributor
I mean when you are debugging. Which line creates the error?
Feb 7 '07 #6
wheeto
5 New Member
I mean when you are debugging. Which line creates the error?

Sorry my mistake, the line code doesn't create an error, The program shows the error when running.
The error box shows when you type a file name that doesn't exist on c drive, but if the file already exists on the c drive it will save as normal.

I have also published the program and installed it to see if the error message still shows when installed and running, and it does still show.
I must have missed a line of code somewhere that tells the system to create a new file if one doesn't exist.
Hope this helps, as i have run out of ideas.

Many thanks for your help
Feb 8 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: joseph.inglis | last post by:
I have a web browser object on a form which I have set to edit mode and use the UCOMIConnectionPointContainer interface to hook in and catch events. All working sweetly. Except there...
2
by: Alvo von Cossel I | last post by:
hi, i have a textbox in a form. when you press a Save button, a savefiledialog appears. creating ther file works but everytime you click save, the dialog appears. how do i make the dialog appear...
4
by: John | last post by:
Hi, I generate a report in a comma delimited file and give it a name like MyReport.csv . I then set a Hyperlink control to point tp the file HyperLink1.text = "Download"...
4
by: Richard | last post by:
Hi I'm new to ASP/Web programming so any help would be appreciated... Situation: On my web page I would like to present a link {or button} that would allow the user to download a large file. ...
0
by: Dune | last post by:
Hi there, I have an aspx page that allows users to enter several parameters using drop downs and text boxes. The users then press a button that produces an extract based on the parameters they...
1
by: M Pearson | last post by:
Hello there all, am very new to asp.net programming and am struggling with this problem. What I trying to achieve. On a button click I want the standard web save as dialog to display. The user...
3
by: =?Utf-8?B?YXNkZg==?= | last post by:
Hello. I am making a web application with c# and am using this code: Response.ContentType = "application/x-excel"; Response.AddHeader("Content-Disposition", "attachment;filename=" +...
2
by: vbaDev | last post by:
Hi. I am using Access 2000 and in my code I'm exporting a table into an Excel file (creating it), then the code needs to export another query into the same file (a new worksheet). So I needed both a...
8
by: paquer | last post by:
I'd like to provide an Export Function from my forms, where the User can choose the File name & save location Although I cannot get the "Save As" dialog box to open properly from access. What is...
0
by: ppardi | last post by:
I'm developing an addin for Word 2007 and I need to determine whether a user saves a Word 2007 document in an older format (97-2003) after a save as is done. The scenario is that the user starts...
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...
1
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.