Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/04/2007, 10:29
Avatar de juantux
juantux
 
Fecha de Ingreso: marzo-2005
Mensajes: 59
Antigüedad: 19 años, 10 meses
Puntos: 1
Re: C# - Agregar un control en ejecucion

Espero te sirva esta solucion, tu aplicala en C#

Código:
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim i As Integer
        Dim j As Integer

        For i = 1 To 5
            For j = 1 To 3
                Dim xButton As New Button
                xButton.Name = "Boton" & i & j
                xButton.Visible = True
                AddHandler xButton.Click, AddressOf xButton_Click
                Controls.Add(xButton)
            Next
        Next
    End Sub

    Private Sub xButton_Click(ByVal Sender As Object, ByVal e As System.EventArgs)
        MsgBox("Click boton " & Sender.name)
    End Sub