Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date Format
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
Miscellaneous
Thread ID:
00817419
Message ID:
00820276
Views:
22
I think that's right! :)

>OK, so *you* were talking about replacing the TextBox in the sub-classed UserControl, myuc, and *I* was talking about replacing the TextBox in the "base" UserControl, ucContainer ... right?
>
>~~Bonnie
>
>
>>>
>>>Unless maybe you were talking about a sub-class of the original UserControl inheriting the change to the UserControl, but that's not what I thought you were saying. And, even if that's what you were talking about, it still inherits the change ok. So, I guess I'm still up in the air as to what you were trying to say.
>>>
>>>~~Bonnie
>>
>>This is the code that the designer gives you.
>>
>>public class ucContainer : System.Windows.Forms.UserControl
>>{
>>	private System.Windows.Forms.TextBox textBox1;
>>...
>>	private void InitializeComponent()
>>	{
>>		this.textBox1 = new System.Windows.Forms.TextBox();
>>...
>>
>>
>>The container is wrapping an instance of TextBox. You can subclass the container but you can't subclass the instance.
>>
>>	public class myuc : ucContainer
>>
>>you are still wrapping the generic TextBox instance.
>>
>>If you want to replace the TextBox with a different instance you have to rip out the designer code. You can fix it by passing in an instance of the control that you want to wrap in the constructor of the container or use a factory method, but its awkward is all I'm saying.
>>
>>If you look at how the .net framework classes for DataGridTextBoxColumn work there is a lot of good code there that does the formatting and parsing of the contained textbox (the column has a format property that works the way you would expect) but no way to reuse their code.
Previous
Reply
Map
View

Click here to load this message in the networking platform