' A simple Event Driven WinForm Application ' Downloaded from www.publicjoe.co.uk ' ' This software is provided 'as-is', without any express or implied warranty. ' In no event will the author(s) be held liable for any damages arising from ' the use of this software. ' ' Permission is granted to anyone to use this software for any purpose, ' including commercial applications, and to alter it and redistribute it ' freely. Imports System Imports System.Drawing Imports System.Windows.Forms Public Class Form1 Inherits Form Public Sub New() MyBase.New() InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub Private components As System.ComponentModel.IContainer Friend WithEvents Label1 As Label Friend WithEvents TextBox1 As TextBox Friend WithEvents Button1 As Button Friend WithEvents Label2 As Label Private Sub InitializeComponent() Me.Label1 = New Label Me.TextBox1 = New TextBox Me.Button1 = New Button Me.Label2 = New Label ' 'Label1 ' Me.Label1.Location = New Point(40, 40) Me.Label1.Name = "Label1" Me.Label1.Size = New Size(100, 20) Me.Label1.TabIndex = 0 Me.Label1.Text = "Enter Your Name : " ' 'TextBox1 ' Me.TextBox1.Location = New Point(140, 38) Me.TextBox1.Name = "TextBox1" Me.TextBox1.TabIndex = 0 Me.TextBox1.Text = "" ' 'Button1 ' Me.Button1.Location = New Point(140, 80) Me.Button1.Name = "Button1" Me.Button1.Size = New Size(70, 20) Me.Button1.TabIndex = 1 Me.Button1.Text = "Click Me" ' 'Label2 ' Me.Label2.Location = New Point(40, 120) Me.Label2.Name = "Label2" Me.Label2.Size = New Size(250, 20) Me.Label2.TabIndex = 0 ' 'Form1 ' Me.AutoScaleBaseSize = New Size(5, 13) Me.ClientSize = New Size(300, 180) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.TextBox1) Me.Controls.Add(Me.Label1) Me.Name = "Form1" Me.Text = "Event Driven Form" End Sub 'Run the application Public Shared Sub Main() Application.Run(New Form1( )) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label2.Text = "Thanks a Lot " + TextBox1.Text End Sub End Class