events

Handling VB.NET events in VB6 code

I have some VB6 code that instantiates a class which handles events that are being raised from a VB.NET component. The VB6 is pretty straightforward: private m_eventHandler as new Collection ... public sub InitSomething() dim handler as EventHandler set handler = new EventHandler m_eventHandler.Add handler ... m_engine.Star...

Flex Image source event, How to know when the new source is received ?

Hi all :) I have a simple Image component, I change its source dynamically on creation. myimg.source = "http://foo/bar.jpg" How can i know when the image is loaded and received so that i can check its width ? Thanks ...

Invalid Postback error when Databinding a gridview.

I really hate this error, because it can be so hard to pin point. In this case, I have a page with a user control on it that contains a gridview. When a button is clicked to view one of the records in the gridview, a pop-up window (in the form of a modal dialog) opens allowing the user to edit the fields. Then, when the pop-up is clos...

How to cancel a routed event?

I have a WPF application, where when a user unchecks a checkbox, the application will prompt to confirm. If the user chooses not to continue (cancel) is selected, i want to cancel the uncheck event. In another word, i want the checkbox to remain checked. How can i do that in WPF? Thanks in advance. ...

Jquery asp.net Button Click Event via ajax

Hi all, I was wondering if anyone can point me in the right direction. I have an asp.net button with an click event (that runs some server side code). What i'd like to do is call this event via ajax and jquery. Is there any way to do this? If so, i would love some examples. Thanks in advance ...

Why is it necessary to add new events to the *end* of an IDL interface?

I have found that when I add new events to an existing COM/IDL interface, I sometimes run into strange issues unless they are added to the end of the interface. For example, say I have the following interface: interface IMyEvents { HRESULT FooCallback( [in] long MyParam1, [in] long MyParam2, [in] long MyPara...

How do I write events and eventhandlers in C#?

I've been trying a good way to memorize how to write events and eventhandlers in C# for a while. Whenever I want to refer to a tutorial on the Internet they tend to be verbose. The question is how do I write events and eventhandlers in C#? Have you got a code example that illustrates easily how to write such? ...

LinkButton in nested UserControls not firing Command event

I have a nested UserControl (this control is dynamicall loaded by another UserControl that is dynamically loaded by an aspx page inside a MasterPage) in which I would like to use a LinkButton and the OnCommand Event. This button must be added to some panel, so I hooked up to the OnLoad event of the panel (it needs to be created before e...

Cancel Event in WinBinder

Is it possible to cancel events in WinBinder? I.e. I want to prohibit some characters in a EditBox (textbox) I listen on the WBC_KEYDOWN-Event for my control. In other languages I'd return false or set the character-code (here in $lparam2) to null - but there seems to be no function/construct to do this in WinBinder. ...

Internet Explorer and JavaScript event currentTarget

Is there a way to take the current target of an event with ie 7 or 8? With other browser (firefox, opera, chrome etc.) we can use event.currentTarget or also we can use the 'this' kewyword to refer the object received the event. But in explorer we don't have currentTarget property and the 'this' refers to window object! So how can I d...

top-level exception handling with event handlers in c#

Hi, I am currently asking myself some questions about exception handling and eventhandlers, and i hope some of you will give me some help. I will start to explain what i would like to achieve in my c# application: I have a top-level method (lets call it the main method). This method calls an asynchronous method (wich is called connect...

How can an Excel Add-In respond to events in any worksheet?

Our workbooks are server-generated SpreadsheetML, which cannot include any VBA code. Creating native Excel files or Excel 2007 XML files is also not an option, unfortunately. So, I have an Excel Add-In (VBA, not XLL) that each of our users installs to add some extra UDFs, etc. that our workbooks need. This works great, but now I need t...

C# Custom EventArgs Question

Hi all, I have a custom collection that I am adding a ValidateItem event to. This ValidateItem event will be called whenever an item is added to or updated in the custom collection. I want to allow derived classes to be able to subscribe to the event and determine their own logic for whether or not an item is "valid" and potentially pr...

UnHooking Events with Lambdas in C#

I often run into a situation where I want to subscribe to an event, but I want to use a lambda to do so: public class Observable { public event EventHandler SomethingHappened; public void DoSomething() { // Do Something... OnSomethingHappened(); } } // Somewhere else, I hook the event observable.Somethi...

How do I connect to events when using templates?

I'm new to Silverlight/XAML/C# and havn't figured out all the concepts yet. I'm using the Accordion control together with some templates, the XAML looks like this: <layoutToolkit:Accordion x:Name="MatchesAccordion" SelectionMode="ZeroOrMore" Width="Auto" SizeChanged="MatchesAccordion_SizeChanged"> <layoutToolkit:Accordion.HeaderTemp...

Greasemonkey + jQuery: using GM_setValue() within an event callback

I'm trying to set data in long-term storage in a GreaseMonkey script, except that GM_setValue() seems to fail silently: $("a#linkid").click(function() { GM_setValue("foo", 123); // doesn't work, but does not generate error }); GM_setValue("bar", 123); // works properly, value is set ...

Validation Before Postback Event on Masterpage Asp.net

Hi all, I was wondering if anyone knew of a way to do some client side validation with jquery and then run the postback event manually for a asp.net control? Here's a sample Master page i.e. <script type="text/javascript"> $(document).ready(function() { $("#<%=lnkbtnSave.ClientID %>").click(function() { alert("hello"); ...

Why does this bookmarklet JS code not work when put in an onclick handler?

I have a pretty typical bookmarklet code that's working perfectly for me in all browsers. However, when I take this code and put it in an HTML's element onClick handler, it doesn't work in IE (6, 7, or 8). This is the code: javascript: ( function(){ function l(i,u){ var d=document; var s; try{ s=d.standardCreateElement(...

Are there any limitations to what can be done in an inline onclick handler?

When adding code to an onclick handler, are there any limitations to what can be done? Can I have unlimited statements separated by ; ? Can I declare variables that will live in the global scope? Can I declare an anonymous function right in there and call it? (function(){})();? Is there any limitation? The reason I'm asking is that i'm...

Detect Mouse Move Event On JPanel

I have a JPanel, which I would like to detect the following events (1) When the mouse move in (2) When the mouse move out The (1) is quick easy. (2) is a bit tricky. Currently, I have to register event at all the components around JPanel. If the neighbor around JPanel detected a mouse move in event, this also means that JPanel is havi...