Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 150,095 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,809 people online right now. Registration is fast and FREE... Join Now!




Error in Vb2008?

 
Reply to this topicStart new topic

Error in Vb2008?, File exists error: SaveFileDialog

VbProgrammer08
1 Jun, 2008 - 02:12 PM
Post #1

New D.I.C Head
*

Joined: 31 May, 2008
Posts: 9



Thanked: 1 times
My Contributions
I have this little piece of code:

CODE

            Dim saveFileDialog2 As New SaveFileDialog()
            saveFileDialog2.Title = "Name the file..."
            saveFileDialog2.ShowDialog()
            saveFileDialog2.OverwritePrompt = True
            saveFileDialog2.RestoreDirectory = True

            If saveFileDialog2.FileName <> "" Then
                 ' save file code here
            End If


Anyways, when I actually save the file, it asks me if I want to overwrite an existing file. If I say yes, the program crashes and an exception is thrown:

" Could not complete operation since a file already exists in this path 'C:\example.jpg'. "

Is it an easy fix or is it complicated?

I'm getting tired with Vb at this point mad.gif Thanks again for your help. (I started Vb programming just a few days ago- so I'm not good with Windows-related programming. I'm a C++/DirectX10 game programmer though). It's so simpler than C++, yet so difficult? lol!

Thanks again smile.gif

This post has been edited by VbProgrammer08: 1 Jun, 2008 - 02:15 PM
User is offlineProfile CardPM
+Quote Post

VbProgrammer08
RE: Error In Vb2008?
1 Jun, 2008 - 06:40 PM
Post #2

New D.I.C Head
*

Joined: 31 May, 2008
Posts: 9



Thanked: 1 times
My Contributions
Viola! I fixed it with a little research:
CODE
My.Computer.Network.DownloadFile(httpDownloadReq, saveFileDialog2.FileName, "", "", True, 100, True)


This post has been edited by VbProgrammer08: 2 Jun, 2008 - 04:09 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 12:11AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month