WithEvents : WithEvents « Event « VB.Net Tutorial

Home
VB.Net Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statements
5.Date Time
6.Class Module
7.Development
8.Collections
9.Generics
10.Attributes
11.Event
12.LINQ
13.Stream File
14.GUI
15.GUI Applications
16.Windows Presentation Foundation
17.2D Graphics
18.I18N Internationlization
19.Reflection
20.Regular Expressions
21.Security
22.Socket Network
23.Thread
24.Windows
25.XML
26.Database ADO.net
27.Design Patterns
VB.Net
VB.Net by API
VB.Net Tutorial » Event » WithEvents 
11.5.1.WithEvents
WithEvents
imports System
imports System.Drawing
imports System.Windows.Forms

public class AddressOfWithEvents : inherits System.Windows.Forms.Form

  Dim WithEvents btn as Button

  public sub New()
    btn = new Button()
    btn.Location = new Point(50,50)
    btn.Text = "Test"

    Controls.Add(btn)
        AddHandler btn.Click, AddressOf btn_Click
  end sub

  public shared sub Main() 
    Application.Run(new AddressOfWithEvents())
  end sub

  private sub btn_Click(ByVal sender as object, _
      ByVal e as EventArgs)
    MessageBox.Show("btn_Click method","Events Demonstration")
  end sub

  private sub btn_ClickHandles(ByVal sender as object, _
      ByVal e as EventArgs_
      Handles btn.Click
    MessageBox.Show("btn_ClickHandles method","Events Demonstration")
  end sub

end class
11.5.WithEvents
11.5.1.WithEventsWithEvents
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.