09-27-2024
08:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
09-27-2024
08:29 AM
This is a block of code I have in pretty much all of my export code routines. You can switch it over to using MessageBox.Show if you want, but if you do, then also replace 'MsgBoxResult' Type with 'DialogResult' Type, because they return different types of values. Those vbYes & vbNo constants were originally designed for use with the MsgBox, hence their Type being MsgBoxResult, but it is a good idea to use the proper Type objects, when possible, in production related tools.
If System.IO.File.Exists(sFullFileName) = True Then
Dim oAns As MsgBoxResult = MsgBox("The following file already exists." & vbCrLf & _
sFullFileName & vbCrLf & "Do you want to overwrite it?", _
vbYesNo + vbQuestion + vbDefaultButton2, "FILE ALREADY EXISTS")
If oAns = MsgBoxResult.No Then Exit Sub
End If
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS)
.
Wesley Crihfield
(Not an Autodesk Employee)