Hi,

I have an application which consists of an MDI Form and x amound of child forms which are created dynamically. Each of the child forms contains a button which is created on the fly, programattically:

For i = 1 To intDocCount
'Add new Form:
f1 = New Form()
f1.MdiParent = Me
f1.Text = objWord.Documents.Item(i).FullName

'Add 'Select Text' Button:
myButton = New Button()
myButton.Location = New System.Drawing.Point(120, 6)
myButton.Visible = True
f1.Controls.Add(myButton)
f1.Show
Next

As the Buttons are created programattically and dynamically (ie, if there are 5 forms, 5 buttons are created) I am a little confused as to how to create an On_Click event for each of them.

How do I create an On_Click event for each button created?

Any help would be much appreciated

Many thanks,

Chris