Hi there. I've been searching this for a while but can't find out how to fix it yet. I think it may be a known bug but not sure how to work around it...
I have a VB.NET program with a SaveFileDialog control with the filter set as ".asx|*.asx|.m3u|*.m3u" (without the quotes). It works fine to save a file, but if I then try to save a file with the same name of an existing file and then change the extension in the save as type box, it still thinks I want to save the file as the existing file and asks to overwrite the file, disregarding the newly selected file extension.
I have tried setting the SaveFileDialog.FileName = Nothing after saving a file, so the Save File Dialog Box the File name box is empty, but then I like to click the existing file to get the file name I want, then select a new extension and try to save, but it still asks to overwrite the file with the other extension.
I hope my situation is clear and sorry if it has been already asked a million times...but can anyone point me in the right direction or tell me how I can save the file with the currently selected extension, not the previous selected extension when the file name was entered?
Thanks for any help. Here is the code I'm using if it helps...
Code:
If SaveFileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
If Path.GetExtension(SaveFileDialog.FileName) = ".asx" Then
' Code Here to Prepare the CodeASX ...
File.WriteAllText(SaveFileDialog.FileName, CodeASX)
End If
If Path.GetExtension(SaveFileDialog.FileName) = ".m3u" Then
' Code Here to Prepare the CodeM3U ...
File.WriteAllText(SaveFileDialog.FileName, CodeM3U)
End If
' SaveFileDialog.FileName = Nothing
End If