PC Review


Reply
Thread Tools Rate Thread

Control Events

 
 
Nathan Carroll
Guest
Posts: n/a
 
      11th Oct 2003
Is it possible to loop through events of a control to determine which events
are active? In other words I want to dynamically add controls that will be
clones of controls I have placed in form including any events.


 
Reply With Quote
 
 
 
 
Tom Spink
Guest
Posts: n/a
 
      11th Oct 2003
Hi, after dynamically creating the control, you can use AddHandler to attach
a method to the control's event:

AddHandler MyControl.MyEvent, AddressOf MyEventHandler

Is this what you are looking for?

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

" System.Reflection Master "

==== Converting to 2002 ====
Remove inline declarations


"Nathan Carroll" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Is it possible to loop through events of a control to determine which

events
> are active? In other words I want to dynamically add controls that will be
> clones of controls I have placed in form including any events.
>
>



 
Reply With Quote
 
Nathan Carroll
Guest
Posts: n/a
 
      12th Oct 2003
When I say 'ParentControl' I mean as a source not a container for the new
control. ie I have properties of my mother but she does not contain me, My
house is my container.

Well I intend to utilize that, but what i'd like is someway to clone the
control as a new control. for instance:
dim NewControl as new TextBox
dim c as control
For each c in me.panel.controls
if typeof c is Textbox
'create control NewControl
'1. 'set properties of newcontrol=properties of c 'via loop
or with
'2. 'Loop events of c and the add handlers to NewControls
events
me.Panel2.controls.add(NewControl)
end if
end if

I won't know if the control has any events. Would I be able to set all of
the events of the NewControl even if the 'ParentControl' shows no event?
Add handlers for each event of the controltype? Does that make any sense?

"Tom Spink" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi, after dynamically creating the control, you can use AddHandler to

attach
> a method to the control's event:
>
> AddHandler MyControl.MyEvent, AddressOf MyEventHandler
>
> Is this what you are looking for?
>
> --
> HTH,
> -- Tom Spink, Über Geek
>
> Please respond to the newsgroup,
> so all can benefit
>
> " System.Reflection Master "
>
> ==== Converting to 2002 ====
> Remove inline declarations
>
>
> "Nathan Carroll" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Is it possible to loop through events of a control to determine which

> events
> > are active? In other words I want to dynamically add controls that will

be
> > clones of controls I have placed in form including any events.
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Control events raised in a control from a project Mike Microsoft VB .NET 0 28th Jul 2007 06:18 PM
Delete events/procedures of control if control is deleted at design time in VB.Net 2005 ? Luqman Microsoft VB .NET 1 30th Jun 2006 08:15 PM
How can i handle a control's Events on a Multipage control? konox Microsoft ASP .NET 0 31st Oct 2005 09:10 AM
How can I make a control show inherited events from System.Windows.Forms.Control Ralph Krausse Microsoft Dot NET Framework Forms 1 13th Nov 2004 09:21 PM
Translating child events into parent-control events Scott McChesney Microsoft VB .NET 0 7th May 2004 04:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:18 PM.