Random images on buttons

  • Thread starter Thread starter RogerGarro
  • Start date Start date
R

RogerGarro

Guest
Good evening made the following code, create an array of buttons and panels, now how do I insert random images to those buttons, can you help me please.

Public Sub crearBotonesPaneles(ByVal creaBoton(,) As Button, ByVal creaPanel As Panel)

Dim puntoLocacion As Point
puntoLocacion.X = 20
puntoLocacion.Y = 40

For filas As Integer = 0 To 1
For columnas As Integer = 0 To 3
If IsNothing(creaBoton(filas, columnas)) Then
creaBoton(filas, columnas) = New Button
creaBoton(filas, columnas).Location = puntoLocacion
creaBoton(filas, columnas).Width = 50
creaBoton(filas, columnas).Height = 50


creaPanel.Controls.Add(creaBoton(filas, columnas))
puntoLocacion.X = puntoLocacion.X + 50


End If

Next
puntoLocacion.X = 20
puntoLocacion.Y = puntoLocacion.Y + 50
Next

End Sub

Continue reading...
 
Back
Top