473,480 Members | 1,531 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Click event seems to fire multiple times

DEK
Stepping through my code the click eventhandler code
executes through a few times before it finally stops.
Even though I only click the button once, is there a reason
for this, I have a few if else and method calls in the
eventhandler.

--
Thanks
DEK
Nov 13 '05 #1
3 11182
DEK,

Are these method calls doing anything that could trigger the click
event? Is your click event handler hooked up to multiple event handlers and
then you are calling other methods that could possibly cause those events to
be fired?

Can you post some sample code?
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"DEK" <DE*@DEK.COM> wrote in message
news:MP************************@news.cis.dfn.de...
Stepping through my code the click eventhandler code
executes through a few times before it finally stops.
Even though I only click the button once, is there a reason
for this, I have a few if else and method calls in the
eventhandler.

--
Thanks
DEK

Nov 13 '05 #2
DEK
In article <OH**************@TK2MSFTNGP10.phx.gbl>,
ni**************@exisconsulting.com says...
DEK,

Are these method calls doing anything that could trigger the click
event? Is your click event handler hooked up to multiple event handlers and
then you are calling other methods that could possibly cause those events to
be fired?

Can you post some sample code?

MainForm is a singleton form, InfoView is a user control.
the class is a panel of buttons and has methods to set them
enabled/disabled in certain ways, I.e. (this.ShowAddEditButtons).

private void add_Click(object sender, EventArgs e)
{
MainForm form = MainForm.GetInstance();
Contestant contestant = form.CurrentNode.Tag as Contestant;

// Root View
if (!form.InfoView.Visible && form.TableListView.Visible)
{
form.TableListView.Visible = false;
form.InfoView.Visible = true;

form.InfoView.Table = contestant.Blank.Tables
[Constants.Info];

form.InfoView.HeadingCat = "Adding a new";
form.InfoView.RefreshControl(true);
}

// Composite View
else if(form.InfoView.Visible && form.TableListView.Visible)
{
form.TableListView.Visible = false;
form.InfoView.Table = Season.GetInstance
(null).Individuals.Blank.Tables[Constants.Info];

form.InfoView.HeadingCat = contestant.Name + " - Adding a
new";

form.InfoView.RefreshControl(true);
}

// Change button views
this.ShowAddEditButtons();
form.InfoView.Focus();

}
--
Thanks
DEK
Nov 13 '05 #3
DEK
In article <MP************************@news.cis.dfn.de>, DE*@DEK.COM
says...
In article <OH**************@TK2MSFTNGP10.phx.gbl>,
ni**************@exisconsulting.com says...
DEK,

Are these method calls doing anything that could trigger the click
event? Is your click event handler hooked up to multiple event handlers and
then you are calling other methods that could possibly cause those events to
be fired?

Can you post some sample code?

MainForm is a singleton form, InfoView is a user control.
the class is a panel of buttons and has methods to set them
enabled/disabled in certain ways, I.e. (this.ShowAddEditButtons).

private void add_Click(object sender, EventArgs e)
{
MainForm form = MainForm.GetInstance();
Contestant contestant = form.CurrentNode.Tag as Contestant;

// Root View
if (!form.InfoView.Visible && form.TableListView.Visible)
{
form.TableListView.Visible = false;
form.InfoView.Visible = true;

form.InfoView.Table = contestant.Blank.Tables
[Constants.Info];

form.InfoView.HeadingCat = "Adding a new";
form.InfoView.RefreshControl(true);
}

// Composite View
else if(form.InfoView.Visible && form.TableListView.Visible)
{
form.TableListView.Visible = false;
form.InfoView.Table = Season.GetInstance
(null).Individuals.Blank.Tables[Constants.Info];

form.InfoView.HeadingCat = contestant.Name + " - Adding a
new";

form.InfoView.RefreshControl(true);
}

// Change button views
this.ShowAddEditButtons();

It was this last line^^^^

That method called refreshControl which reattached all the handlers
again, I moved the attaching of handlers to the constructor so they only
attached once, thanks.

--
Thanks
DEK
Nov 13 '05 #4

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

Similar topics

2
2360
by: Heather R | last post by:
I am writing a windows service that has a notifyicon component. The component displays accordingly, but for some reason, I cannot get the click or double click event to fire. It seems like none of...
24
7603
by: Charles Law | last post by:
When I click a button I don't want the click event to fire. Is this possible? In fact, what I would really like is to be able to intercept the click event, perform some action, and then prevent...
2
1830
by: schiefaw | last post by:
Hello, I created a custom event "Public Event ApprovalChangedEvent()" and set a function to catch it "Private Sub laset_ApprovalChangedEvent() Handles laset.ApprovalChangedEvent". The problem...
5
22688
by: Dundealing | last post by:
I have a single button on my form, and when I press the Enter key while a TextBox has focus I want the Button.Click event to fire. Is there a simple way to do this ?
0
1163
by: pbr | last post by:
I have set up a tabControl with 5 tabpages. Visual Studio built a .Click event when I doubleclicked on a specific tabpage and this is what I want for my program. But when I run the program and then...
0
1539
by: Harry Keck | last post by:
I have a 1.1 web application that I recently converted to a 2.0 web application. I found that the HttpApplication.AcquireRequestState event is now getting called three times, where it was only...
2
2530
by: AMDRIT | last post by:
Hello Everyone, I am having an issue where an event appears to be fired repeatedly where I only expect it to be fired once. See below for objects and behaviors. I have a control that contains...
1
1517
by: netman38 | last post by:
Hi, I couldnt find a solution to my problem. I created linkbutton dynamically and also add an eventhandler dynamically. However when i click the button an empty page is reloaded. My guess is, my...
2
7158
by: Joergen Bech | last post by:
Hope someone has a solution or some suggestions for this. This cannot be right?!? Problem: I have multiple non-modal forms open at the same time. One or more of these forms have a...
0
7044
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6908
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7045
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7087
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
6944
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5341
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4782
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
2995
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2985
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.