Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Visual Basic Miscellaneous Dynamic Usage of Event Handlers in VB.NET Tutorial

In VB.NET we can receive and handle events in 2 ways. The first one is using WithEvents and Handles keywords, and the second way is to use the AddHandler method and dynamically add event handlers through our code and with RemoveHandler dynamically remove

Tutorial Details:

Code Beach - Dynamic Usage of Event Handlers in VB.NET


All .NET ASP BREW C++ C# ColdFusion Delphi/Kylix HTML J2ME Java JavaScript Palm Perl PHP Pocket PC Python SQL Ruby Symbian Visual Basic XML

Dynamic Usage of Event Handlers in VB.NET by: Thomas Kaloyani
With Events and Handles clause requires form us to declare the object variable and the event handler as we write our code, so linkage is created upon compilation. On the other hand, with AddHandler and RemoveHandler, linkage is created and removed at runtime, which is more flexible.

Let's assume that we want to load several MDI child forms, allowing each of them to be loaded only once, and of course to know when one of the child forms is closed. Since we have several forms to load we would like to use the AddHandler and RemoveHandler keywords so we can be flexible and write the minimal code we can.
Let's get dirty.
1. In each MDI child form we have to declare a public event.
Public Event FormClosed(ByVal f As Form)
2. In each MDI child form we have to use the Form_Closed method which handles the MyBase.Closed class and raise the FormClosed event.


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Visual Basic Miscellaneous Dynamic Usage of Event Handlers in VB.NET Tutorial

View Tutorial:
Visual Basic Miscellaneous Dynamic Usage of Event Handlers in VB.NET Tutorial

Related Tutorials:

Create automated and distributed management applications with Jiro technology, Part 1 - JavaWorld February
Create automated and distributed management applications with Jiro technology, Part 1 - JavaWorld February 2000
 
C# : A language alternative or just J--? (part1)
C# : A language alternative or just J--? (part1)
 
Robust event logging with Syslog - JavaWorld April 2001
Robust event logging with Syslog - JavaWorld April 2001
 
XML APIs for databases - JavaWorld January 2000
XML APIs for databases - JavaWorld January 2000
 
Master Java with these introductory books - JavaWorld May 2001
Master Java with these introductory books - JavaWorld May 2001
 
Log it or loose it
Log it or loose it
 
Take the sting out of SAX
Take the sting out of SAX
 
Best tools for mobile application development
Best tools for mobile application development
 
Profiling CPU usage from within a Java application
Profiling CPU usage from within a Java application
 
A first look at JavaServer Faces, Part I
A first look at JavaServer Faces, Part Learn how to implement Web-based user interfaces with JSF
 
Let the mobile games begin, Part 2
Let the mobile games begin, Part 2
 
Customize SwingWorker to improve Swing GUIs
Customize SwingWorker to improve Swing GUIs
 
Excellent tutorial on Struts and Tiles
Excellent tutorial on Struts and Tiles This tutorial assumes knowledge of Java, JDBC, Servlets, J2EE (with regards to Web applications) and JSP Struts in a holistic manner, minus the beads and crystals. The Tiles framework makes creating reusable pages
 
Creating EL-Aware Taglibs Using XDoclet
Creating EL-Aware Taglibs Using XDoclet When the JSP Tag Extensions (also known as taglibs) first came out, the only option to pass dynamic values as tag attributes was using Request Time (RT) expressions. With the advent of JSTL 1.0, another option ha
 
Building Highly Scalable Servers with Java NIO
Building Highly Scalable Servers with Java NIO I/O Event Handling The I/O architecture of our router was strongly inspired by the Swing event-dispatch model. In Swing, events generated by the user interface are received by the JVM and stored in an even
 
Light-Weight Visual Components Library for different platform: SWT, J2SE, J2ME, .NET
Light-Weight Visual Components Library for different platform: SWT, J2SE, J2ME, .NET
 
Servlet Essentials
This document explains the concepts of Java Servlets and provides a step-by-step tutorial for writing HTTP Servlets with complete source code for the example Servlets. The tutorial and the other chapters cover all facets of Servlet programming from a ...
 
Interoperability with Patterns and Strategies for Document-Based Web Services
In Part 2 of this article, we demonstrate interoperability for document-driven web services with Microsoft .NET (C#) using strategies discussed in Part 1.
 
Open Source Web Frameworks in Java
Open Source Web Frameworks in Java Open Source Web Frameworks in Java Struts Struts Frame work is the implementation of Model-View-Controller (MVC) design pattern for the JSP. Struts is maintained as a part of Apache Jakarta project and is open
 
Building Search Engine Applications Using Servlets !
Building Search Engine Applications Using Servlets ! Building Search Engine Applications Using Servlets Please visit http://www.webappcabaret.com/javadevelopers/search to see running copy of our search engine. Introduction This tutorial takes
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.