Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Events
Message
 
To
14/11/2004 12:42:20
General information
Forum:
ASP.NET
Category:
Forms
Title:
Re: Events
Miscellaneous
Thread ID:
00961252
Message ID:
00961271
Views:
7
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>
Previous
Reply
Map
View

Click here to load this message in the networking platform