I have a sizeable form that can be toggled between showing the toolbar and not. To hide the toolbar, I set ControlBox = False, and Text = "".
If I toggle from toolbar visible to toolbar not visible, the form DialogResult is set to cancelled.
Looking at the code at the Form's OnTextChanged method in reflector, I can see that the form's handle is recreated, sometimes, when ControlBox = False. This must be what is changing the DialogResult to Cancel.
To get round the problem, I first set the text to "", and then set ControlBox to False.
This works, but I don't want any surprises later on.
Does anyone know why the form's handle is recreated sometimes when ControlBox = False?