问题
How do I make sure SaveAs Dialog return a filename with the extension?
For Example:
'Test' (.txt) return 'test.txt'
But:
'Test 1.0' (.txt) return 'Test 1.0' (Should be 'Test 1.0.txt')
Possible solution: I can manually check if there is a '.txt' at the end, but if there are two extension types (.txt, .doc), how do I know which one the user selected?
Thank you!
回答1:
I believe you need to set the .SupportMultiDottedExtensions to True, like so:
Using tDialog As SaveFileDialog = New SaveFileDialog
With tDialog
.Filter = "Text Files|*.txt"
.SupportMultiDottedExtensions = True
.ShowDialog()
MsgBox(.FileName)
End With
End Using
来源:https://stackoverflow.com/questions/9593305/saveas-dialog-with-a-period-in-the-filename-does-not-return-extension