Preventing a combo box from changing

BrownFingers

Member
Joined
Nov 21, 2008
Messages
15
Programming Experience
Beginner
I am using a combobox to select from a list of customers and display the customers data depending on the selection.

What I would like to do is introduce a Save Prompt, i.e. if the customers data has changed and they try to select another customer using the customer combo, I'd like to display "Do you wish to Save Changes?", Yes/No/Cancel

If Cancel is selected I would like to prevent the selection of the new customer and leave the combo on the existing customer.

Any ideas how I can achieve this?
 
Well, the changes made will still be around in memory, so do you really want to be annoying the user with prompts all the time? Remember, prompts interrupt workflow and eventually become irritating. Typically, you'd let them use the combo to switch between X number of customers and only save (or ask to save) when they do something that will cause the loss of info like closing the form
 
Personally I do want to prompt when they change the customer record. Lets say they made changes to 10 customers and you waited till the form closed to prompt them to save changes. At that stage they wouldn't remember what they changed in each of those customers and whether or not they want to save those changes for the individual customers. I think my request to save changes when they change customer is a very reasonable request and I'd be surprised if winforms does not allow you to do this in a combobox.
 
Glad I dont have to use any of your apps; having a program ask questions all the time is the single most disruptive, irritating thing in HCI.

However, if you want to do this you can attach to the positionchanged event of the relevant bindingsource and ask the user if they want to save the previous details. Your class can hold reference to the previous row (which you update after the question, to be the current row)
 
Back
Top