开发者

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,

  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.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜