events

Event log code error not being able to find the Event Source?

I am trying to use the Event Log to write some debug information and I can't make it works. It complains about not being able to find the Event Source. Do I have to install something on the OS? ...

Is there a way in javascript to detect if the unload event is caused via a refresh, the back button, or closing the browser?

I am currently looking at the "unload" event of a window to try to determine how the "unload" event was triggered, but am having little success. Is there a way to determine how the javascript event was triggered? Page Refresh Back Button (or navigate away from the page) Closing the Browser Essentially I need to execute some code only...

How to correctly unregister an event handler

In a code review, I stumbled over this (simplified) code fragment to unregister an event handler: Fire -= new MyDelegate(OnFire); I thought that this does not unregister the event handler because it creates a new delegate which had never been registered before. But searching MSDN I found several code samples which use this idiom. So...

Event Log SecurityException for Web Application?

I have an app that writes messages to the event log. The source I'm passing in to EventLog.WriteEntry does not exist, so the Framework tries to create the source by adding it to the registry. It works fine if the user is an Admin by I get the following whe the user is not an admin: "System.Security.SecurityException : Requested registry...

IIS Recycle Global.asax

Is it possible to catch an recycle event in the global.asax? I know Application_End will be triggered but is there a way to know that it was triggered by a recycle of the application pool? thx, Lieven Cardoen aka Johlero ...

C# Best practice: Centralised event controller or not

I have an app which consists of several different assemblies, one of which holds the various interfaces which the classes obey, and by which the classes communicate across assembly boundaries. There are several classes firing events, and several which are interested in these events. My question is as follows: is it good practice to imp...

Producer consumer pattern when many products

Hi, I have a producer-consumer pattern working for one product. What is the best implementation when the producer produce many products? For example a DataBaseEvent, GuiEvent and ControlEvent that the consumer shall consume. The code below shows the pattern for one product (a DataBaseEvent). Should each event type be enqueued on an own q...

Getting notified when the datetime changes in c#

Recently I was trying to make a calendar application that will display the current year-month-date to the user. The problem is, if the user is gonna keep my application running even for the next day, how do I get notified ?? How shall I change the date displayed ? I don't wanna poll the current date to update it. Is this possible in c#. ...

How do I implement a cancelable event?

In System.ComponentModel, there's a class called CancelEventArgs which contains a Cancel member that can be set in event listeners. The documentation on MSDN explains how to use that to cancel events from within a listener, but how do I use it to implement my own cancelable events? Is there a way to check the Cancel member after each l...

How to get notified about changes on SharePoint groups.

Hi, I'm actual looking for a way to get notified about any changes on a SharePoint group. First I though I would be able to this by attaching a event handler to some kind of group list. But unfortunately there are no such list representing SharePoint groups. My second attempt was to bind a event handler to the content type SharePointG...

Problem with WPF data binding and Access Keys

Please consider the following example. Note that in the real-word, the binding source will likely be a data object. I'm using a TextBlock for simplicity. <Window x:Class="Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height=...

Adding handlers to Dynamically Created Context Menu

I need to populate a context menu from a database at run time. I do not know the number of items that will be in the list, so I would like to handle the click event in a single place. How do I declare the handler so I can tell which menu item actually triggered the click. Thanks, Dave Public Function GetBookmarkContextMenu(ByVal aBo...

How do I get PowerShell to grab a logfile when it overflows?

I am using Powershell PSeventing plugin but have had no luck so far finding an event that triggers when an event log is full. I am looking everywhere MSDN .net events I know it has to do with maximum event log size but I can't find that trigger and I'm not sure how to get PSeventing to make thing happen. Can anyone help me. Thank in a...

Why do I get this error creating & returning a new struct?

I get an error when I compile this code: using System; public struct Vector2 { public event EventHandler trigger; public float X; public float Y; public Vector2 func() { Vector2 vector; vector.X = 1; vector.Y = 2; return vector; // error CS0165: Use of unassigned local variable 've...

jQuery Event Keypress: Which key was pressed?

With jQuery, how do I find out which key was pressed when I bind to the keypress event? $('#searchbox input').bind('keypress', function(e) {}); I want to trigger an submit when ENTER is pressed. [Update] Even though I found the (or better: one) answer myself, there seems to be some room for variation ;) Is there a difference betwee...

ASP.net information event "Application compilation is starting"

Hi all: We use MSMQ to capture all the event thrown by our asp.net site and store the data into our database. Throughout the day, we can see the event id "1003" with Title = "Application compilation is starting" in our logging database. However, we don't see the corresponding event 1004 which is "Application compilation ends". I was ...

How do I learn if events are bound to an element using jquery?

I need a hasEvents() method like var someBool = hasEvents($("#myelement")); that returns true if there are some bound events to any of the element's event handlers. ...

Unregistering Event with -=-Operator

Hi When opening a window, I register a Deleted-event-handler on my business object. It is passed to the constructor as business: business.Deleted += new EventHandler<EventArgs>(business_Deleted); Now the user can click a button to delete it (removing the record, you know). The event handler is registered to capture deletion by other ...

ASP.NET: Problem with event handlers for dynamically created controls

Hi, I've got this problem with dynamically created TextBox. When the TextBox is created in PageLoad, it's TextChanged event was fired. But when I dynamically delete and recreated the TextBox, the TextChanged was not fired. This is the code: .aspx <asp:Table ID="Table1" runat="server"> <asp:TableRow> <asp:TableCell ...

Setting an Event handler without doing it manually in the classname.designer.cs file

Is there any way to set an event handler without doing it manually in the classname.designer.cs file other than double clicking the UI element? ...