views:

150

answers:

2

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

regards.

A: 

the best way is to provide a custom event for this.

Jack
+1  A: 

Could be several ways,

  1. Throw an exception and catch where it is necessary to process.
  2. Use custom events; here is an example.
  3. Use generic event handler; see the example.
KMan