imports System
imports System.Drawing
imports System.Windows.Forms
public class ButtonPerformClick : inherits Form
dim btn1 as Button
dim btn2 as Button
public sub New()
Size = new Size(200,100)
btn1 = new Button()
btn1.Parent = me
btn1.Text = "Button1"
btn1.Location = new Point(10,10)
AddHandler btn1.Click, AddressOf btn1_Click
btn2 = new Button()
btn2.Parent = me
btn2.Text = "Button1"
btn2.Location = new Point(100,10)
AddHandler btn2.Click, AddressOf btn2_Click
end sub
private sub btn1_Click(ByVal sender as object,ByVal e as EventArgs)
MessageBox.Show("Button1 clicked.")
btn2.PerformClick()
end sub
private sub btn2_Click(ByVal sender as object,ByVal e as EventArgs)
MessageBox.Show("Button2 clicked.")
end sub
public shared sub Main()
Application.Run(new ButtonPerformClick())
end sub
end class
|