Dim filename As String = System.IO.Path.GetFileName(saveFileDialog1.FileName)
Will result in a string that will display in MsgBox but will crash the program if this is used as the string name for saving. I've checked once it crashed and it's identical to a working string.
Yeah....that's....ummm....badly written code. it makes a rather HUGE assumption. That would be that the user actually selected a filename and not hit Cancel instead.
Don't combine the two operations here. Just ShowDialog the SFD and CHECK THE RESULT TO SEE IF IT IS VALID before passing it to Path.GetFilename.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)