Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date Format
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Divers
Thread ID:
00817419
Message ID:
00820251
Vues:
15
>
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform