Questions tagged [addhandler]

AddHandler (and the companion RemoveHandler) is used to add (and remove) event handlers dynamically in VB.NET

Add and remove event handlers dynamically in .NET

.NET lets you add and remove Event Handlers dynamically on the fly. Your code can start and stop handling events at any time during program execution. Also, you can tie the same code (event handler) to multiple events similar to the Handles clause in VB.NET.

The VB.NET AddHandler and RemoveHandler statements allow this behavior. Both statements take two arguments: the name of the event to handle and the name of the procedure that will handle the event.

93 questions
21
votes
1 answer

VB.NET RemoveHandler & Anonymous Methods

How do I use RemoveHandler with anonymous methods? This is how I add a handler for MyEvent event of the class MyClass: AddHandler MyClass.MyEvent, Sub() '... End Sub How do I then use…
acermate433s
  • 2,514
  • 4
  • 24
  • 32
10
votes
3 answers

Passing AddressOf to a function in VB.NET to use AddHandler

I need to pass a reference of a function to another function in VB.NET. How can this be done? My function needs to use AddHandler internally, for which I need to pass it a handling function. My code below obviously does not work, but it conveys the…
DieSlower
  • 252
  • 1
  • 3
  • 8
4
votes
2 answers

What is the difference between AddHandler and AddType in htaccess files

Can someone explain what the difference is between AddType and AddHandler in htaccess files? I want to make the settings such that I can have a javascript file (.js) be run through the server as though it were a php file (application/x-httpd-php5)…
rolling_codes
  • 15,174
  • 22
  • 76
  • 112
4
votes
1 answer

htaccess AddHandler ***x-httpd-php5x*** and ***application/x-httpd-php5x***

What is the difference between x-httpd-php5x and application/x-httpd-php5x I'v been using application/x-httpd-php for years with my web hosting (Linux) until they upgrade PHP to version>=5.2. Now I have to use x-httpd-php5x on web hosting which does…
user1643156
  • 4,407
  • 10
  • 36
  • 59
3
votes
1 answer

Visual Studio Shortcut to Auto-Add Event Delegate Methods

In C# adding event handler methods is very easy. You just type "object.event +=" and then press tab twice. Is there anything like this for VB projects? Note: This is for dynamically created controls or controls that are not declared WithEvents.
Kevin
  • 13,044
  • 11
  • 55
  • 76
2
votes
1 answer

update event isn't fired in a dynamic gridview

I'm creating a dynamic gridview in vb.net using a connected sql database. Everything works fine except 1 thing: when i click the update command, the event just won't fire no matter what I do. the gridview goes into edit mode and the cancel button…
2
votes
1 answer

How to stop Webview2 reloading website after NavigationCompleted event. VB.NET C#

I have a module that opens a Form with a Webview2 browser. The Webview2 control then uses the user username and password (which he entered earlier into two textboxes) to log into a website and loads through a few links to a specific webpage where…
2
votes
3 answers

GWT Widget.addHandler

I am trying to utilize Widget.addHandler(). However, the handler never gets called. Below is my sample code. What do I need to change to fix this? My Handler Implementation: public class CustomMouseMoveHandler extends…
Peter
  • 67
  • 1
  • 2
  • 7
2
votes
2 answers

Modify working AddHandler to match files only in the CURRENT directory, NOT child directories

The following works fine for allowing PHP to be executed on two XML files: AddHandler application/x-httpd-php5 .xml However unfortunately this rule would allow this to happen in any child…
John
  • 1
  • 13
  • 98
  • 177
2
votes
1 answer

500 Internal Server Error on Apache/PHP AddHandler wrapper

I'm trying to create a wrapper/handler that will be called on the Apache server whenever someone requests any PHP script inside of a directory. That way I can authorize users for the entire directory or write some other stuff to be called when the…
user471231
  • 23
  • 5
2
votes
4 answers

How do I add parameters to an event handler in javascript?

and thanks for looking. Currently I am implementing code from this example. In my aspx file, I have Label1 and Textbox1 defined. In my aspx.cs file, I am setting the Label1.Text property to a random string in the Page_Load method. In the .js file I…
Freakishly
  • 1,533
  • 5
  • 32
  • 61
2
votes
1 answer

DataGridViewRowsAdded handler gives errors

I'm trying to add the RowsAdded and CellFormatting handlers to my project. I seem to have cleared up all errors in the CellFormatting handler but my RowsAdded is giving some errors that I cannot figure out. Argument not specified for parameter…
ZL1Corvette
  • 415
  • 1
  • 6
  • 24
2
votes
0 answers

Apache: help understand Action and AddHandler directives

I'm trying to puzzle out Apache handlers. The official documentation has the following example: The following directives will cause requests for files with the html extension to trigger the launch of the footer.pl CGI script. Action add-footer…
2
votes
2 answers

AddressOf not working

I am having a issue with a c# to vb.net conversion, but AddHandler is not working for me. Can anyone help? this.ucSurveyWebControl.OnResponseRecieved += new…
John D
  • 79
  • 1
  • 3
2
votes
1 answer

Firing event doesn't work on SelectedIndexChanged

My webpage is built dynamically in VB.Net (aspx). I have a checkbox, that after checked will open a new window. While opening the window some parameters are passed through for using the correct data in the window, however there is one parameter…
Schuere
  • 1,579
  • 19
  • 33
1
2 3 4 5 6 7