Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Events
Message
 
À
14/11/2004 12:42:20
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Titre:
Re: Events
Divers
Thread ID:
00961252
Message ID:
00961271
Vues:
6
Thanks again!

I think i found a way (maybe) here's the code:
private void baseForm_Load(object sender, System.EventArgs e)
{
	foreach( Control c in this.Controls )
	{
		IDataAwareControl d =  c as IDataAwareControl;
		if (d!=null)
		{
			d.DataChange += new EventHandler(d.OnDataChange);
		}
	}
}
Does it make sense to go that route ?

>Well, off the top of my head, you could probably handle this with Interfaces. IOW, have an interface defined that implements the custom Event. Have your form implement that Interface. Then, in the KeyPress event of your TextBox class, you could check whether the parent implements that Interface and subscribe to the custom event if it does. In order to find the parent, you will probably have to recursively iterate through this.Parent until you've found the Interface implentation or it's null. If you're not familiar with interfaces at all, you'll probably need me to explain this a little further with some code, but if you can follow what I'm saying, then go for it! <g>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform