SaveFileDialog.Overwrite Prompt problem

ahmad_hamdan

Member
Joined
May 24, 2010
Messages
19
Programming Experience
Beginner
hello everyone,

i have a small code to save an image, i use a savefiledialog to set the path and image name when i try to save to an already existing image, a prompt is supposed to be shown since i am setting overwriteprompt to true but the problem it won't show and the save file dialog just hangs in there and i can't close it or do anything in it, i know the prompt dialog is there but i can't see it.

I am using .net framework 4.0 with visual studio 2010 and my windows is windows 7 home premuim 64bit

here is my save file dialog code:

VB.NET:
Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click
        If bm IsNot Nothing Then

            If svfd.ShowDialog = DialogResult.OK Then

                If svfd.FileName.EndsWith(".jpg") Then
                    SaveImage(ImageFormat.Jpeg)
                Else
                    If svfd.FileName.EndsWith(".GIF") Then
                        SaveImage(ImageFormat.Gif)
                    End If
                End If
            End If
        End If


    End Sub



 Private Sub SaveImage(ByVal extension As ImageFormat)
        bm.Save(svfd.FileName, extension)
    End Sub

Can you please help me with it?
 
Last edited:
With the given code you've provided, I have no idea what the problem could be. I don't see where you're even using the FileName property either.
 
I have added the saving code, but the problem isnot in that code infact when i debug i reach "If svfd.ShowDialog = DialogResult.OK Then
" and i can't get after it, but if i tried to save and the file doesn't exist everything works good, the problem when the file exists the prompt in save dialog is created but i can't see it, i know that because i am not able to do anything in the save dialog after i click save it just stays there waiting for me to click ok or yes in the un seen overwrite prompt
 
Back
Top