473,385 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

notification techniques in nested user controls

Hi,

I have a Form with many UserControls on it. Some of the UserControls contain
other Controls.
What is the best way of notifying each of the nested controls about an event
that has occured on one of them?
Are there any mechanisms for broadcasting messages down the owning chain?

Mark
Nov 16 '05 #1
2 1726
Hi Marek
No, there is no any mechanism that will automate that for you. The only
mechanism that WindowsForms supports are events. But each control that wants
to be notified needs to hook on that event.

The easiest way I believe (ofcourse it is not a painkiller and might be not
suitable for some projects) is to declare helper serivice class that
exposes a static public events and respective public static raise methods.
This way the events are accessible to any object that wants to hook on them
and any object can raise some of those events using the RaiseXXX methods if
wants to notify the others. Over simmilar pattern VS, for example, is built.
Ofcourse they have more powerful and flexible service system (with service
containers and stuff) rather than static events.
--
HTH
Stoitcho Goutsev (100) [C# MVP]

"Marek" <ma**************@sbcglobal.net> wrote in message
news:ZS******************@newssvr17.news.prodigy.c om...
Hi,

I have a Form with many UserControls on it. Some of the UserControls
contain other Controls.
What is the best way of notifying each of the nested controls about an
event that has occured on one of them?
Are there any mechanisms for broadcasting messages down the owning chain?

Mark

Nov 16 '05 #2
Thank you for your help.

"Stoitcho Goutsev (100) [C# MVP]" <10*@100.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi Marek
No, there is no any mechanism that will automate that for you. The only
mechanism that WindowsForms supports are events. But each control that
wants to be notified needs to hook on that event.

The easiest way I believe (ofcourse it is not a painkiller and might be
not suitable for some projects) is to declare helper serivice class that
exposes a static public events and respective public static raise methods.
This way the events are accessible to any object that wants to hook on
them and any object can raise some of those events using the RaiseXXX
methods if wants to notify the others. Over simmilar pattern VS, for
example, is built. Ofcourse they have more powerful and flexible service
system (with service containers and stuff) rather than static events.
--
HTH
Stoitcho Goutsev (100) [C# MVP]

"Marek" <ma**************@sbcglobal.net> wrote in message
news:ZS******************@newssvr17.news.prodigy.c om...
Hi,

I have a Form with many UserControls on it. Some of the UserControls
contain other Controls.
What is the best way of notifying each of the nested controls about an
event that has occured on one of them?
Are there any mechanisms for broadcasting messages down the owning chain?

Mark


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: DotNetGuru | last post by:
Hi, I have nested User Controls like below. User_Control_1 User_Control_11 User_Control_12(contains method DisplayMessage) User_Control_2(contains event onButtonClick ) User_Control_1 and...
3
by: Guadala Harry | last post by:
I have this scenario: ASPX Page dynamically loads userControl1 - which in turn dynamically loads userControl2. UserControl2 contains a TextBox Web Server control. When a user clicks a button in...
5
by: ~~~ .NET Ed ~~~ | last post by:
Hi, As you all know when an ASP.NET web form is created that will include web controls and such, it contains a FORM that that identifies the web form and its containing controls. Well, I have a...
2
by: nulldevice | last post by:
I've got a datagrid with some nested controls, created at design-time. The controls themselves have no databound values. After a few other operations on the page (selecting a few parameters,...
20
by: Robert | last post by:
Need some help to stop me going around in circles on this one.... Have a nested subform (subform2) which simulates a continuous form for the record on the parent subform. Subform2 has rows of...
2
by: aarf | last post by:
Does anyone have an opinion or fact if nested user controls are a best practice, especially if you want performance from the page? I've seen pages that nest about 4 levels of user controls. ...
2
by: brad | last post by:
Group, I'm using Visual Studio 2003 to create an ASP.NET 1.1 project which contains nested server user controls in order to create a tree-like hierarchy. The tree is a sort of question and...
2
by: Sebastian Paul | last post by:
Hi, I have a user control (EventStructureSelector) used in another user control (ResultsMenu). The class EventStructureSelector defines a public type (ModeType), that is used for one of its...
2
by: Frank Rizzo | last post by:
I have an app, which has a composite User Control which includes other User Controls. The problem is that when I drop the composite user control on the form, the nested User Controls think that...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.