Discussion Locked
0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I am working on a school project using Visual Basic 6 to make a copy of Windows XP Notepad. I'm working on the functionality of the Save/Save As menu items and am using the Visual Basic Common Dialog to set Save parameters. I use the CommonDialog.ShowSave to bring up the dialog, but whether I hit Save or Cancel during program execution, the next statement is executed saving the program. I need the dialog to return something saying that the user hit cancel, but I can't figure out which property it is. I would think it is the CommonDialog.CancelError, but that always returns False (or True if it was set to True previous to showing the dialog). Any Suggestions?
3 replies
by lowlands
You are on the right track. You need to use Commondialog.CancelError. But you need to set it to true. That way an error is generated when the user clicks cancel. You'll now have to trap the error and have it cancel the save procedure.
by bckurd
Hello!
it is not very complex at all. First, when you show up the dialog make sure that the dialog will pass a result to a variable what could keep the information if user has cancelled or saved etc. Here is an example what could give you some insight how to control dialog boxes... :)
Cheers!
Dim Result as DialogResult
Result = FileSaveDialog1.show
if Result = DialogResult.OK Then
' enter the statement you want to execute
'if user has already performed a positive action
end if
Thankyou both for your advice. I was able to get it to work by handling the error caused when the user hits the cancel button.
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending
Discussion Locked
What Makes a Business Website Effective in 2026
2 helpful
10 replies
Question
Windows and macOS computers becoming slow or unstable after updates - what should I check first
0 helpful
1 reply
1 helpful
3 replies
Discussion
Optimizing WordPress widgets and DOM size
0 helpful
3 replies
Discussion Locked
Best Ways to Improve Website Visibility
0 helpful
5 replies