By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,836 Members | 2,059 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,836 IT Pros & Developers. It's quick & easy.

Raising events from constituent controls

P: n/a
If a screen is made up of several user controls and those user controls contain various packaged or standard controls such as a grid, how do you raise both standard and custom events from the user control so the form containing the user control can see the events you want them to see.
Help Please....
Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi

on the user control you need to declare a public event and raise it with
raiseevent youreventname, you raise the event on the usercontrol when
something hapens on the usercontrol that you want the form to be aware of.

if you've declared an event and placed the raiseevent where you need it in
the usercontrol. You can catch it in the code of your form containing the
control by going to the code editor and than in the left combo where you
select all your controls, select your control. Next in the right combo you
will be able to select your event you declared.

Hth Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.

"snesbit" <sn*****@portaltech.com> schreef in bericht
news:Ol**************@tk2msftngp13.phx.gbl...
If a screen is made up of several user controls and those user controls
contain various packaged or standard controls such as a grid, how do you
raise both standard and custom events from the user control so the form
containing the user control can see the events you want them to see.
Help Please....
Nov 21 '05 #2

P: n/a
Peter,

I think I understand, but let me clarify
Example

User Control contains an infragistics grid (that
has its own events)

I place the User Control on a new form.

I want to see/use specific infragistics grid
events on the new form.

Best approach to solve?
"Peter Proost" <pp*****@nospam.hotmail.com> wrote in message
news:OA**************@tk2msftngp13.phx.gbl...
Hi

on the user control you need to declare a public event and raise it with
raiseevent youreventname, you raise the event on the usercontrol when
something hapens on the usercontrol that you want the form to be aware of.

if you've declared an event and placed the raiseevent where you need it in
the usercontrol. You can catch it in the code of your form containing the
control by going to the code editor and than in the left combo where you
select all your controls, select your control. Next in the right combo you
will be able to select your event you declared.

Hth Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.

"snesbit" <sn*****@portaltech.com> schreef in bericht
news:Ol**************@tk2msftngp13.phx.gbl...
If a screen is made up of several user controls and those user controls
contain various packaged or standard controls such as a grid, how do you
raise both standard and custom events from the user control so the form
containing the user control can see the events you want them to see.
Help Please....

Nov 21 '05 #3

P: n/a
Hi,

for example your infragistics grid (infragisticsGrid) has an event called
gridFilled, and you place the infragisitics grid on a usercontrol called
MyUsercontrol

then in your usercontrol you will have something like

private sub infragisticsGrid_GridFilled (.....) handles infragistics.filled

end sub

now you need to declare and raise an event in your usercontrol like this

Public event MyGridIsFilled ()

and then raise it inside the infragisticsGrid_GridFilled (.....)

so it will look like this:

Public event MyGridIsFilled ()

private sub infragisticsGrid_GridFilled (.....) handles
infragisticsGrid.filled
RaiseEvent MyGridIsFilled
end sub
now on your form in the code you can select in the left combo your
usercontrol (MyUsercontrol)
and in the right combo there will be an event MyGridIsFilled. If you select
something like this will be created

Private sub MyUserControl_MyGridIsFilled(.....) handles
MyUserControl.MyGridIsFilled

End sub
Hope it's clear

greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.

"snesbit" <sn*****@portaltech.com> schreef in bericht
news:ua*************@TK2MSFTNGP12.phx.gbl...
Peter,

I think I understand, but let me clarify
Example

User Control contains an infragistics grid (that
has its own events)

I place the User Control on a new form.

I want to see/use specific infragistics grid
events on the new form.

Best approach to solve?
"Peter Proost" <pp*****@nospam.hotmail.com> wrote in message
news:OA**************@tk2msftngp13.phx.gbl...
Hi

on the user control you need to declare a public event and raise it with
raiseevent youreventname, you raise the event on the usercontrol when
something hapens on the usercontrol that you want the form to be aware of.
if you've declared an event and placed the raiseevent where you need it in the usercontrol. You can catch it in the code of your form containing the control by going to the code editor and than in the left combo where you
select all your controls, select your control. Next in the right combo you will be able to select your event you declared.

Hth Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

"snesbit" <sn*****@portaltech.com> schreef in bericht
news:Ol**************@tk2msftngp13.phx.gbl...
If a screen is made up of several user controls and those user controls
contain various packaged or standard controls such as a grid, how do you
raise both standard and custom events from the user control so the form
containing the user control can see the events you want them to see.
Help Please....


Nov 21 '05 #4

P: n/a
Got it ...Thanks

"Peter Proost" <pp*****@nospam.hotmail.com> wrote in message
news:OX**************@TK2MSFTNGP15.phx.gbl...
Hi,

for example your infragistics grid (infragisticsGrid) has an event called
gridFilled, and you place the infragisitics grid on a usercontrol called
MyUsercontrol

then in your usercontrol you will have something like

private sub infragisticsGrid_GridFilled (.....) handles infragistics.filled
end sub

now you need to declare and raise an event in your usercontrol like this

Public event MyGridIsFilled ()

and then raise it inside the infragisticsGrid_GridFilled (.....)

so it will look like this:

Public event MyGridIsFilled ()

private sub infragisticsGrid_GridFilled (.....) handles
infragisticsGrid.filled
RaiseEvent MyGridIsFilled
end sub
now on your form in the code you can select in the left combo your
usercontrol (MyUsercontrol)
and in the right combo there will be an event MyGridIsFilled. If you select something like this will be created

Private sub MyUserControl_MyGridIsFilled(.....) handles
MyUserControl.MyGridIsFilled

End sub
Hope it's clear

greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.

"snesbit" <sn*****@portaltech.com> schreef in bericht
news:ua*************@TK2MSFTNGP12.phx.gbl...
Peter,

I think I understand, but let me clarify
Example

User Control contains an infragistics grid (that
has its own events)

I place the User Control on a new form.

I want to see/use specific infragistics grid
events on the new form.

Best approach to solve?
"Peter Proost" <pp*****@nospam.hotmail.com> wrote in message
news:OA**************@tk2msftngp13.phx.gbl...
Hi

on the user control you need to declare a public event and raise it with raiseevent youreventname, you raise the event on the usercontrol when
something hapens on the usercontrol that you want the form to be aware
of.
if you've declared an event and placed the raiseevent where you need it in
the usercontrol. You can catch it in the code of your form containing the control by going to the code editor and than in the left combo where
you select all your controls, select your control. Next in the right combo

you will be able to select your event you declared.

Hth Peter
--
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

"snesbit" <sn*****@portaltech.com> schreef in bericht
news:Ol**************@tk2msftngp13.phx.gbl...
If a screen is made up of several user controls and those user controls contain various packaged or standard controls such as a grid, how do you raise both standard and custom events from the user control so the form containing the user control can see the events you want them to see.
Help Please....



Nov 21 '05 #5

P: n/a
If you want the events of the consituent controls available to the designer, you have to define wrapper events in the container control and stitch the events up by hand (i.e., in code). See http://winfx.msdn.microsoft.com/libr...8aec5c662b.asp. If you want the events available programmatically only, then you can make the constituent controls public--this is of course an all or nothing affair.

"snesbit" <sn*****@portaltech.com> wrote in message news:Ol**************@tk2msftngp13.phx.gbl...
If a screen is made up of several user controls and those user controls contain various packaged or standard controls such as a grid, how do you raise both standard and custom events from the user control so the form containing the user control can see the events you want them to see.
Help Please....
Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.