Dim newButton As New Button ' Add properties to the form. newButton.Name = "btn" + controlCount.ToString() newButton.Text = "btn" + controlCount.ToString() newButton.Location = New Point(controlLocation.X + 250, controlLocation.Y) controlLocation.Y += newButton.Height + 5 ' Add the two event handlers. AddHandler newButton.Click, AddressOf myButtonHandler_Click AddHandler newButton.MouseHover, AddressOf myButtonHandler_MouseHover ' Add the control to the collection of controls. Controls.Add(newButton) |