473,323 Members | 1,622 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,323 software developers and data experts.

How do i stop event handler firing twice?

guy
I have a base winform Base and a form that inherits from it Child
in the base form there is an event handler for a combo box click

Protected Overrideable Sub cboPickList_SelectedIndexChanged(ByVal sender As
Object, ByVal e As System.EventArgs) Handles cboPickList.SelectedIndexChanged
DoStuff
End Sub

and in Child Form

Protected Overrides Sub cboPickList_SelectedIndexChanged(ByVal sender As
Object, ByVal e As System.EventArgs) Handles cboPickList.SelectedIndexChanged
DoOtherStuff
End Sub

I would have expected that on a cboPickList SelectedIndexChanged event the
Child form event handler would be called and that the Base form one would not
however the Child Form handler is called TWICE. It looks like it is catching
an event from both the Child and Base forms

Removing the Handles clause from the base form seems to stop this however
sometimes i want the base form handler to be called (when a different child
does not override it)

any ideas how to stop this?

guy
Nov 21 '05 #1
2 5918
"guy" <gu*@discussions.microsoft.com> schrieb:
[Inherited handlers]


You may want to remove the handler added in the base class in the derived
class:

\\\
RemoveHandler Me.Button1.Click, AddressOf MyBase.Button1_Click
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #2
guy
Thanks Herfried I should have thought of that!

cheers

guy

"Herfried K. Wagner [MVP]" wrote:
"guy" <gu*@discussions.microsoft.com> schrieb:
[Inherited handlers]


You may want to remove the handler added in the base class in the derived
class:

\\\
RemoveHandler Me.Button1.Click, AddressOf MyBase.Button1_Click
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #3

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

Similar topics

3
by: Peter Row | last post by:
Hi, I have created a user control consisting of a textbox and a separate vertical scroll bar. The textbox is filled with data. However there could be lots of data so I only fill the textbox...
4
by: Seraph | last post by:
Again, I'm rather new here, so if I fail to follow any etiquette, please forgive me and let me know what I've done wrong, but I think this might interest quite a few people. One of my colleaques...
7
by: Denise | last post by:
I just realized the DataTable_RowChanging events were firing when I called Fill method of the DataAdapter! It fires TWICE for each row loaded. I thought these were only supposed to be called when...
0
by: Matthew | last post by:
All, I have searched google and the newsgroups but can't find anything the same as what I am experiencing (though I may have missed something). I have controls (textboxes) within UserControls...
1
by: dave | last post by:
What I am attempting to do is cancel an event in IE inside of my event handler, but the handler keeps getting called: for example if I do <div id="foo"> <div id="test">test text</div> </div>...
0
by: JR | last post by:
I am opening a html page using showModalDialog. To the page's onError event, i am attaching custom event handler. When ever any exception occures, onError event is firing 2 times. I found the same...
2
by: John Kotuby | last post by:
Hi guys, I am converting a rather complicated database driven Web application from classic ASP to ASP.NET 2.0 using VB 2005 as the programming language. The original ASP application works quite...
18
by: joaotsetsemoita | last post by:
Hello everyone, I'm having troubles assigning an onclick event to a cell. Im trying something like cursorPoint.cells.style.cursor = "hand"; cursorPoint.cells.width = "20";...
3
by: =?Utf-8?B?QmFycnkgR2lsYmVydA==?= | last post by:
I have a class that raises events that downstream objects subscribe to. In one case, after destroying the object, the event seems to still get handled in a subscriber object. So I instantiate an...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.