Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing base classes
Message
From
18/07/2004 11:33:39
Del Despain
Colorado Plateau Associates
Hurricane, Utah, United States
 
 
To
18/07/2004 09:37:00
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00925304
Message ID:
00925573
Views:
13
Thanks Bonnie!


>Del,
>
>If the 3rd party form's controls are exposed as public properties, then in your sub-class you could maybe make them invisible and add your own controls instead in the place of the invisible ones. Of course, it probably depends somewhat on what the control that you're trying to replace is supposed to do. You may not be able to duplicate some of it's functionality, but then again, by replacing it with a different control maybe you don't *want* to duplicate it's functionality.
>
>That's the only thing that I can think of off the top of my head and of course if they haven't exposed the controls as public properties you won't be able to do this.
>
>~~Bonnie
>
>>Ok, I guessed as much. Here is what I keep running into. I get a 3rd party class or tool that includes a form containing controls which inherit directly from .net controls. I create a subclass of that form for my own use so that the base class can be updated. Then I find an enhanced control (that may also get future updates) that I would like the form to make use of without mucking with the original 3rd party base class. I'm not sure how best to deal with this situation without having to duplicate lots of code.
>>
>>Thanks!
>>
>>Del
>>
>>
>>>Keith,
>>>
>>>I think you may have mis-understood Del's question. If he sub-classes Form2 from Form1, none of Form1's controls will show up in Form2's code.
>>>
>>>So Del, the answer is no, you cannot do it.
>>>
>>>~~Bonnie
>>>
>>>>>If I sub-class a form containing controls, is there any way to override the class that a specific control on the form inherits from? In other words, can I force the control to inherit from a different class than it inherits from on the parent/base form. I assume not and can see the reasoning, but wondering anyway.
>>>>>
>>>>>Thanks!
>>>>>
>>>>>Del
>>>>
>>>>Del,
>>>>
>>>>The controls don't inherit from the form. They are instances of built-in .NET classes that are independent of the form. To see the control declarations, expand the collapsed region near the top of the code. I forget exactly what .NET calls the region.
>>>>
>>>>In the code, you should see each control declaration. You can change the inheritance by modifying the line. .NET will not overwrite your changes once they are made.
Previous
Reply
Map
View

Click here to load this message in the networking platform