Hide control inherited from a base form in a specific derived form, this at design-time !
-
Hello everybody, My question is quite simple and i'm not sure there is a solution. But if you have any suggestions to go round, it would be great as i'm not really content of what i'm doing so far. Here is the problem : Let say you have a base form named FORM and 3 derived forms (FORM1...). On the base form you have several controls (buttons, textbox, labels, more than 10) taking all space of the form. On the derived forms you can see them all (design- and run-time) Very easy so far. Let say now that i wan't to replace a textbox by a combobox ONLY on FORM1. I add my combobox at the right place, i make my textbox non-visible by setting the property and all is ok at run-time... but not in the designer ! where i don't have the place to put my inherited textbox cause it's still visible at design-time and my form is full of controls. To make even more simple, i would like to prevent the designer from showing, in a particular derived form, a control inherited from a base form. My "solution" for the moment is to set the location property of my textbox at "1000;1000" so it is not visible in the designer. Thanks for your help S.
-
Hello everybody, My question is quite simple and i'm not sure there is a solution. But if you have any suggestions to go round, it would be great as i'm not really content of what i'm doing so far. Here is the problem : Let say you have a base form named FORM and 3 derived forms (FORM1...). On the base form you have several controls (buttons, textbox, labels, more than 10) taking all space of the form. On the derived forms you can see them all (design- and run-time) Very easy so far. Let say now that i wan't to replace a textbox by a combobox ONLY on FORM1. I add my combobox at the right place, i make my textbox non-visible by setting the property and all is ok at run-time... but not in the designer ! where i don't have the place to put my inherited textbox cause it's still visible at design-time and my form is full of controls. To make even more simple, i would like to prevent the designer from showing, in a particular derived form, a control inherited from a base form. My "solution" for the moment is to set the location property of my textbox at "1000;1000" so it is not visible in the designer. Thanks for your help S.
I suspect you must have some reasons for not doing this, but wouldn't this be more straightforward if you just stripped the controls from the base form that don't actually appear on all the derived forms, and just leave a hole where these replaceable controls go?
-
I suspect you must have some reasons for not doing this, but wouldn't this be more straightforward if you just stripped the controls from the base form that don't actually appear on all the derived forms, and just leave a hole where these replaceable controls go?
Thanks for your reply. Actually I have 8 derived forms which use 15+ identical controls. But for 1 of these derived forms, 4 controls have to be replaced. What you suggest, tell me if i'm wrong, is to remove these 4 controls from the base form and add them in each derived forms (7 here). But if i do that i'll loose the factorisation benefit for these controls.
-
Thanks for your reply. Actually I have 8 derived forms which use 15+ identical controls. But for 1 of these derived forms, 4 controls have to be replaced. What you suggest, tell me if i'm wrong, is to remove these 4 controls from the base form and add them in each derived forms (7 here). But if i do that i'll loose the factorisation benefit for these controls.
You could derive in 3 steps: Form1 without the 4 controls Form2 = Form1 + 4 controls type 1 Form3 = Form1 + 4 controls type 2 and 7 forms derived from Form2
-
You could derive in 3 steps: Form1 without the 4 controls Form2 = Form1 + 4 controls type 1 Form3 = Form1 + 4 controls type 2 and 7 forms derived from Form2
Thanks Frank. That's a clean and acceptable solution since you don't have to deal with many controls on many derived forms. I simplified the example to make it clear but if i do that in my real case, i will multiply the depth of inheritance and the forms without a functional purpose.