Hi,
I have an application that has a user created control, the data in this control is used to populate color boxes in a seperate user control contained within the same form.
How can i call a function of the form that my two controls are in without having a form object in each of the controls
Thanks for any help,
-Dave

Message passing... telling the form the control is in to do something
K C
UserControl
public class MyUserControl : UserControl
{
public event EventHandler ColorChanged;
public Color MyColor
{
get
{
return _myColor;
}
set
{
if( _myColor != value )
{
_myColor = value;
OnColorChanged();
}
}
}
protected void OnColorChanged()
{
if( ColorChanged != null )
{
ColorChanged( this, EventArgs.Empty );
}
}
}
coesurf
What is wrong with events
DusanMihajlovic
Thanks for that PJ, but is there a way to do it without an event handler
The user control checks a variable and if that variable has changed it calls a in the owner form.