Link to home
Start Free TrialLog in
Avatar of michouis
michouis

asked on

Dialog form closes when Cancel button is pressed

I am displaying a modal form which a user can edit information in text boxes. If they click the Cancel button I am doing a ds.tables(0).rejectchanges which appears to be firing a close-form event... why???
Also, it does not reset the value in the binded text box to the original value like other forms do. Why? I do a ds.tables(0).rows(0).canceledit and then ds.tables(0).rejectchanges and would expect the original value to re-appear in the text box but it does not.... why??

Thanks
Mike
Avatar of Joel Coehoorn
Joel Coehoorn
Flag of United States of America image

When you look at the properties for the form you'll see a property named "CancelButton" that accepts a Button.  If you click the button set there then the form will close and return DialogResult.Cancel.  Clear that property and the form won't close anymore.
Avatar of michouis
michouis

ASKER

I do not have the Cancel button set as the CancelButton property for the form. I have a totally different button called ExitButton that is set to the CancelButton property of the form... so please try again.

Mike
ASKER CERTIFIED SOLUTION
Avatar of Joel Coehoorn
Joel Coehoorn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ok., I changed the DialogResult property to None on all 3 buttons, (Update, Cancel, Exit) and it now behaves normally.

As for the rejectchanges not resetting the value to original value... I removed the binding format of "C"urrency from these text boxes and it also now behaves normally, just no currency formatting.

In all I am fine now. Thanks for your help any ways.

Mike
Gave me some clues which helped in resolution.