working with my windows forms controls framework, I discoverd a very weird thing about numericUpDown controls.
In my framework, to make sure that all controls are “valid” according to certain criterias, I used a recursive method to get all the controls inside the form.
N.B. If you have a windows form holding 1 panels , each panel has 10 controls. If on the form object you use
this.controls.count , you will get ONE not 11. As the controls.count gets ONLY the controls in the first level and it is not recursive.
so back to the numericupdown control. I discovered that the numericupdown is a “composite” control. meaning it is a combination of a textbox and another control called updownbase.
Unlike textbox, combobox, radio buttons, etc. , the numericupdown is tricky in this part.
If you have a recursive function getting the controls in a form: for a numericupdown you will get TWO controls not just one.
So I think this control needs to be treated carefully in any case where you need to loop on the controls in a form.
Leave a Reply