How to call a function...
-
I am writing a .net assembly that contains several UserControls. When a control is clicked, I would like to fire a message to the parent window so it can do something. The parent window is in a different assembly, and the UserControl knows nothing about the parent. How can I call the parent? In MFC/Win32 I could send a message, but I'm new to this C#.NET thing. Is there a standard method to do this? Neil
-
I am writing a .net assembly that contains several UserControls. When a control is clicked, I would like to fire a message to the parent window so it can do something. The parent window is in a different assembly, and the UserControl knows nothing about the parent. How can I call the parent? In MFC/Win32 I could send a message, but I'm new to this C#.NET thing. Is there a standard method to do this? Neil
-
I am writing a .net assembly that contains several UserControls. When a control is clicked, I would like to fire a message to the parent window so it can do something. The parent window is in a different assembly, and the UserControl knows nothing about the parent. How can I call the parent? In MFC/Win32 I could send a message, but I'm new to this C#.NET thing. Is there a standard method to do this? Neil
The UserControl needs to raise an event. Any host (parent) can choose to respond to the event if it wants to. This is the .NET way of doing things and it's much better than the old
SendMessage
way. Look up events and delegates in the documentation.
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).