When I launch a form as a dialog and click a combo box on the form and without selecting any items, I click anywhere else in the form, the form is closed automatically. What events are triggered by this that caused the form close? Is there any good way to look in it?
Are you certain that Form B is closing? Is it possible that it is simply being hidden because Form A is coming to the front of the ZOrder and covering form B?
Try trapping the Closing event of Form B and put a breakpoint there. If the event fires, you should be able to get the Call Stack and see why the form is closing.
Another option you might want to try is to set up the Visual Studio IDE to break on all exceptions. Perhaps there's an exception occurring that is being caught so you don't see it.
Not only the dropdown, but the whole form is closed.
Let me make it clearer.
I have a form (Form A), and a UserControl is loaded from Form A. Then another form (Form B) is loaded from the UserControl. When I click a combo box on Form B, a dropdown is shown as expected. Then without choosing any items in the dropdown, I click any other places in that form (not outside the form), the form (Form B) is closed and the UserControl is also closed. Form A stays. The more weird thing is that the FormClosing event of Form B is executed after the form is closed. None of the this.Close() statements in Form B is executed before the form close.
In the above steps, if I click any places outside the form after opening the dropdown, everything is fine.
subchap said:I click anywhere else in the form, the form is closed automatically
If by chance you actually meant to say that the dropdown is closed, that is correct behavior, in emulation of a standard ComboBox control. The assumption here is that the user is no longer interested in the dropdown list if he clicked elsewhere.
There really shouldn't be anything done in the UltraCombo by default that would cause the containing form to close. What events are you handling? Are you perhaps calling "this.Close()" instead of trying to close the dropdown on the combo?
-Matt