tagged [event-handling]

Handling end process of a windows app

Handling end process of a windows app Is it possible to capture the task manager end process of a windows application within the same windows application itself? I am using a C# 2.0 win app and I woul...

11 May at 07:11

C#: calling a button event handler method without actually clicking the button

C#: calling a button event handler method without actually clicking the button I have a button in my aspx file called btnTest. The .cs file has a function which is called when the button is clicked. H...

5 Mar at 22:48

How to ensure an event is only subscribed to once

How to ensure an event is only subscribed to once I would like to ensure that I only subscribe once in a particular class for an event on an instance. For example I would like to be able to do the fol...

15 Dec at 07:28

How would it be possible to remove all event handlers of the 'Click' event of a 'Button'?

How would it be possible to remove all event handlers of the 'Click' event of a 'Button'? I have a button control, and I'd need to remove all the event handlers attached to its [Click event](http://ms...

9 Sep at 14:40

Does assigning null remove all event handlers from an object?

Does assigning null remove all event handlers from an object? I have defined new member in my class This class has the following event handler that I subscribed to Will setting my member to null as fo...

13 Sep at 08:48

How to remove all eventhandler

How to remove all eventhandler Lets say we have a delegate and an event handler we add multiple events.. ``` for(int x = 0; x

18 Mar at 12:31

Question regarding to value/reference type of events

Question regarding to value/reference type of events On the MSDN, I have found following: Is it reference? If so I do not understand its meaning as when SampleEvent became null, so does the temp

8 Apr at 09:9

Do event handlers stop garbage collection from occurring?

Do event handlers stop garbage collection from occurring? If I have the following code: Will pClass be garbage collected? Or will it hang around still firing its events whenever they occur? Will I nee...

jQuery checkbox checked state changed event

jQuery checkbox checked state changed event I want an event to fire client side when a checkbox is checked / unchecked: Basically I want it to happen for every checkbox on the page. Is this method of ...

30 Jun at 12:42

Avoid duplicate event subscriptions in C#

Avoid duplicate event subscriptions in C# How would you suggest the best way of avoiding duplicate event subscriptions? if this line of code executes in two places, the event will get ran twice. I'm t...

3 May at 17:51

How can I catch both single-click and double-click events on WPF FrameworkElement?

How can I catch both single-click and double-click events on WPF FrameworkElement? I can catch a on a TextBlock like this: I can catch a on a TextBlock like this: ``` private void TextBlock_MouseDown(...

18 Jan at 13:16

Syntax for adding an event handler in VB.NET

Syntax for adding an event handler in VB.NET I have following code i need to convert to VB.NET. Problem is every translation tool I found is converting the add handler part wrong. I don't seem to be a...

How to unsubscribe from an event which uses a lambda expression?

How to unsubscribe from an event which uses a lambda expression? I have the following code to let the GUI respond to a change in the collection. First of all is this a good way to do this? Second: wha...

30 Apr at 07:51

Raise event thread safely - best practice

Raise event thread safely - best practice In order to raise an event we use a method OnEventName like this: But what is the difference with this one ? ``` protected virtual void OnSomethingHappened(Ev...

9 Sep at 08:23

Do i have to unsubscribe from anonymous event handlers of local variables?

Do i have to unsubscribe from anonymous event handlers of local variables? If I have a code that looks something like this: Will `bar` be collected when the method runs out of the scope, or will I hav...

22 Feb at 17:30

Removing anonymous event handlers

Removing anonymous event handlers > [C#: How to remove a lambda event handler](https://stackoverflow.com/questions/1362204/c-how-to-remove-a-lambda-event-handler) Is it possible to remove an event h...

23 May at 10:30

Best practice in declaring events in C#

Best practice in declaring events in C# I know the following two methods work, but I wonder if one is better in terms of performance / maintenance / whatever. The short way: The long way: The long w

28 May at 13:40

How to handle add to list event?

How to handle add to list event? I have a list like this: How to handle adding new position to this list? When I do: I would like to do something like this in my object: And then in my `HandleAddingEv...

23 Jul at 11:30

How can I trace every event dispatched by a component or its descendants?

How can I trace every event dispatched by a component or its descendants? I am trying to determine what events I need to wait for in a test in order to ensure that my custom component has updated all ...

Fire event on enter key press for a textbox

Fire event on enter key press for a textbox I have the following asp.net textbox control. After the user writes something in this textbox and presses the key, I want to run some code from codebehind. ...

21 Feb at 20:29

ASP.NET MVC & Silverlight - fire an event in both with one button?

ASP.NET MVC & Silverlight - fire an event in both with one button? I currently have a little form with a silverlight bit for a person to sign their name and I was wondering if there was a way to have ...

What event catches a change of value in a combobox in a DataGridViewCell?

What event catches a change of value in a combobox in a DataGridViewCell? I want to handle the event when a value is changed in a `ComboBox` in a `DataGridView` cell. There's the `CellValueChanged` ev...

When should I use an event handler over an event aggregator?

When should I use an event handler over an event aggregator? When should I be using an Event Handler versus an Event Aggregator? In my code, I have two ViewModels that controlled by a parent ViewModel...

How to assign click event

How to assign click event I have an array of button which is dynamically generated at run time. I have the function for button click in my code, but I can't find a way to set the button's click name i...

4 May at 22:30

Difference between the KeyDown Event, KeyPress Event and KeyUp Event in Visual Studio

Difference between the KeyDown Event, KeyPress Event and KeyUp Event in Visual Studio Can anyone tell me the difference between the `KeyDown` event, the `KeyPress` event and the `KeyUp` event? I check...