ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cancel button (https://www.excelbanter.com/excel-programming/302387-cancel-button.html)

IamHaxer

Cancel button
 
When using a custom dialog box why doesn't the cancel button work. I mean yes it takes you out of the dialog box but any values you entered while in it (such as selecting a value from a combo box) are still applied if you hit "Cancel" or "Ok". Is there a way to make the changes not apply if you hit "Cancel"?


David Battams

Cancel button
 
What are you telling the Cancel button to do? If you don't have any code in
the event handler then all it will do is close the dialog.

Wayne.


"IamHaxer" wrote in message
...
When using a custom dialog box why doesn't the cancel button work. I mean

yes it takes you out of the dialog box but any values you entered while in
it (such as selecting a value from a combo box) are still applied if you hit
"Cancel" or "Ok". Is there a way to make the changes not apply if you hit
"Cancel"?




IamHaxer

Cancel button
 
Sorry, I'm just starting with all of this. I assumed that the cancel button was pre set to actually cancel anything entered. Any ideas on what code I should put in to make it work as an actual cancel button?

"David Battams" wrote:

What are you telling the Cancel button to do? If you don't have any code in
the event handler then all it will do is close the dialog.

Wayne.


"IamHaxer" wrote in message
...
When using a custom dialog box why doesn't the cancel button work. I mean

yes it takes you out of the dialog box but any values you entered while in
it (such as selecting a value from a combo box) are still applied if you hit
"Cancel" or "Ok". Is there a way to make the changes not apply if you hit
"Cancel"?





David Battams

Cancel button
 
The answer to your question really depends a lot on what it is you are doing
exactly. If I can give you any general advice in the absence of knowledge
about what you are doing then it would be that you could take one of the
following approaches.

1. Don't actually make any changes to data until the user clicks OK.
Clicking Cancel, therefore, simply avoids committing any changes.
2. Reverse any changes made before the user clicked cancel, when they click
cancel.

I'd say that 1 is your best bet, especially if you are just getting started.

Regards,
Wayne.



"IamHaxer" wrote in message
...
Sorry, I'm just starting with all of this. I assumed that the cancel

button was pre set to actually cancel anything entered. Any ideas on what
code I should put in to make it work as an actual cancel button?

"David Battams" wrote:

What are you telling the Cancel button to do? If you don't have any code

in
the event handler then all it will do is close the dialog.

Wayne.


"IamHaxer" wrote in message
...
When using a custom dialog box why doesn't the cancel button work. I

mean
yes it takes you out of the dialog box but any values you entered while

in
it (such as selecting a value from a combo box) are still applied if you

hit
"Cancel" or "Ok". Is there a way to make the changes not apply if you

hit
"Cancel"?








All times are GMT +1. The time now is 12:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com