event-handling

ExecuteComplete ADODB Connection event not fired with adAsyncExecute parameter

本小妞迷上赌 提交于 2019-11-26 21:43:08
问题 I have a problem trying to catch the completion of a stored proc execute asynchronously. Below my code VBA (in a class module named clsAsync): Option Explicit Private WithEvents cnn As ADODB.Connection Private Sub cnn_ExecuteComplete(ByVal RecordsAffected As Long, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pCommand As ADODB.Command, ByVal pRecordset As ADODB.Recordset, ByVal pConnection As ADODB.Connection) MsgBox "Execution completed" End Sub Sub execSPAsync() Set

Accessing functions bound to event handlers with jQuery

浪尽此生 提交于 2019-11-26 21:43:00
With jQuery you can bind functions to an event triggered on a DOM object using .bind() or one of the event handler helper functions. jQuery have to store this internally somehow and I wonder if is it possible given a DOM object, to find out which events have been bound to the object, and access those functions etc. The desired return result could look something like this: { click: [function1, function2], change: [function3], blur: [function4, function5, function6] } PatrikAkerstrand Edit : the method below works only in jQuery < 1.7 You can find a lot of interesting tips and tricks in this

Is it good idea to use “Control.CheckForIllegalCrossThreadCalls = false” [duplicate]

浪尽此生 提交于 2019-11-26 21:41:20
问题 This question already has an answer here: Is it safe just to set CheckForIllegalCrossThreadCalls to false to avoid cross threading errors during debugging? 1 answer I have a class that receives data from serialport. i used action<T> delegate to pass data to the form where it is displayed in a textbox. the thing is i could not access the textbox control, becouse it says: Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on . so i set Control

jQuery: $().click(fn) vs. $().bind('click',fn);

孤街醉人 提交于 2019-11-26 21:36:13
When using jQuery to hookup an event handler, is there any difference between using the click method $().click(fn) versus using the bind method $().bind('click',fn); Other than bind's optional data parameter. For what it's worth, from the jQuery source : jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," + "mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," + "change,select,submit,keydown,keypress,keyup,error").split(","), function(i, name){ // Handle event binding jQuery.fn[name] = function(fn){ return fn ? this.bind(name, fn) : this.trigger(name); }; });

C# pattern to prevent an event handler hooked twice [duplicate]

我与影子孤独终老i 提交于 2019-11-26 21:21:07
This question already has an answer here: How to ensure an event is only subscribed to once 5 answers Duplicate of: How to ensure an event is only subscribed to once and Has an event handler already been added? I have a singleton that provides some service and my classes hook into some events on it, sometimes a class is hooking twice to the event and then gets called twice. I'm looking for a classical way to prevent this from happening. somehow I need to check if I've already hooked to this event... Explicitly implement the event and check the invocation list. You'll also need to check for

Propagating events from one Form to another Form in C#

牧云@^-^@ 提交于 2019-11-26 21:00:26
问题 How can I click a Button in one form and update text in a TextBox in another form? 回答1: If you're attempting to use WinForms, you can implement a custom event in your "child" form. You could have that event fire when the button in your "child" form was clicked. Your "parent" form would then listen for the event and handle it's own TextBox update. public class ChildForm : Form { public delegate SomeEventHandler(object sender, EventArgs e); public event SomeEventHandler SomeEvent; // Your code

Preserve 'this' reference in javascript prototype event handler [duplicate]

痞子三分冷 提交于 2019-11-26 20:43:22
This question already has an answer here: Preserving a reference to “this” in JavaScript prototype functions [duplicate] 7 answers What is the correct way to preserve a this javascript reference in an event handler stored inside the object's prototype? I'd like to stay away from creating temp vars like '_this' or 'that' and I can't use a framework like jQuery. I saw a lot of people talk about using a 'bind' function but was unsure of how to implement it in my given scenario. var Example = function(foo,bar){ this.foo = foo; this.bar = bar; }; Example.prototype.SetEvent = function(){ this.bar

Assign on-click VBA function to a dynamically created button on Excel Userform

六月ゝ 毕业季﹏ 提交于 2019-11-26 20:31:55
I'm creating buttons dynamically on an Excel userform with the following code: With Me.CurrentFrame.Controls.Add("Forms.CommandButton.1") .Caption = "XYZ" .name = "AButton" .Font.Bold = True .ForeColor = &HFF& ... blah blah blah End With I'd like to assign a function to run when these buttons are clicked, but I can't find a straightforward way to do this since there's no property as part of the button itself. Is there a way to do this using the above idiom? Should I be going about this whole thing in a different way? DJ. You need to dynamically create code / event handlers for each button. It

JavaScript: Listen for attribute change?

你说的曾经没有我的故事 提交于 2019-11-26 19:58:34
问题 Is it possible in JavaScript to listen for a change of attribute value? For example: var element=document.querySelector('…'); element.addEventListener( ? ,doit,false); element.setAttribute('something','whatever'); function doit() { } I would like to respond to any change in the something attribute. I have read up on the MutationObserver object, as well as alternatives to that (including the one which uses animation events). As far as I can tell, they are about changes to the actual DOM. I’m

jQuery: more than one handler for same event

a 夏天 提交于 2019-11-26 19:47:51
What happens if I bind two event handlers to the same event for the same element? For example: var elem = $("...") elem.click(...); elem.click(...); Does the last handler "win", or will both handlers be run? Both handlers will run, the jQuery event model allows multiple handlers on one element, therefore a later handler does not override an older handler. The handlers will execute in the order in which they were bound . Suppose that you have two handlers, f and g , and want to make sure that they are executed in a known and fixed order, then just encapsulate them: $("...").click(function(event