PC Review


Reply
Thread Tools Rate Thread

Add inner control event.

 
 
Mr. X.
Guest
Posts: n/a
 
      24th Apr 2010
I have a control.
On that control I have a button.
That is a control (I did it by : add new class, and inherits DataGridView).
On the new dataGridView there is a new property : Button b.

I want to catch events of that button (from the newDataGridView).

What should I do on the eventHandler ? :

AddHandler FNewButton.Click, btnNew_Click
....

Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Me.Click

(Handles what? Me.Click is not right, and b.click cannot be compiled).


Thanks


 
Reply With Quote
 
 
 
 
Armin Zingler
Guest
Posts: n/a
 
      24th Apr 2010
Am 24.04.2010 17:58, schrieb Mr. X.:
> I have a control.
> On that control I have a button.
> That is a control (I did it by : add new class, and inherits DataGridView).
> On the new dataGridView there is a new property : Button b.
>
> I want to catch events of that button (from the newDataGridView).
>
> What should I do on the eventHandler ? :
>
> AddHandler FNewButton.Click, btnNew_Click
> ....
>
> Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Me.Click
>
> (Handles what? Me.Click is not right, and b.click cannot be compiled).


"Handles" works only with fields (variable at class level) declared with
the "Withevents" modifier. Doesn't AddHandler work?


--
Armin
 
Reply With Quote
 
Mr. X.
Guest
Posts: n/a
 
      24th Apr 2010
O.K.
I add : withevents to the declaration of new object.
dim withevents b as button

I didn't have to add the line :
AddHandler ...

just add the line :
Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles FNewButton.Click

Works fine.
Thanks

 
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
system event log, Event ID 7000, Service Control Manager Ed Parker Windows XP Performance 1 20th Nov 2006 12:08 AM
Control where change event does not trigger click event? =?Utf-8?B?c3dvcmRmaXNo?= Microsoft Powerpoint 2 17th Jul 2006 06:21 PM
Pass a form value from a user control to parent control - Event Order issues ab_j@flyingrobot.com Microsoft ASP .NET 0 29th Oct 2004 06:38 PM
Control Exit event kills Button Click Event in Access2002 Forms =?Utf-8?B?TWlrZSBFbGxpb3R0?= Microsoft Access Form Coding 4 20th Oct 2004 05:08 PM
Help: Control lost doesn't raise event after being moved to dynamically loaded user control Thanh Nguyen Microsoft ASP .NET 0 1st Apr 2004 03:23 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:49 PM.