custom events in child userControls c# .net or Child to Parent Communication in UserControls
Okay here is the scenario:
I have a parent "SalesUC" UserControl which contains a "itemDetailsUC" UserControl, as well as a status label. (plz see sample below)
What I want:
If there occurs any exception in itemDetailsUC, it should be able to communicate the exception text to parent control (i.e. SalesUC). Remember: the "ItemDetailsUC" is also used in other controls that may or may not have status label.any suggestions, answers... please.
Framework: .net 3.0/3.5 Language: c# Domain: Windows Application, WinForms, etc.
Sample ScreenShot
rega开发者_开发百科rds.
Could be several ways,
- Throw an exception and catch where it is necessary to process.
- Use custom events; here is an example.
- Use generic event handler; see the example.
精彩评论