Tiburon de numeros aleatorios

(1/1)

_-Javier-_:
este es mi 2 post aver si les interesa
utilizaremos el programa visual studio 2008.

1 creamos un new project (de tipo windows form) y creamos la interfaz



2 en el boton el siguiente codigo
Código
       Dim aleatorio As Integer()
       Dim r As New Random
       ReDim aleatorio(2)
       'asignando valores
       For i As Integer = 0 To aleatorio.Length - 1
           aleatorio(i) = r.Next(1, 5)
           TextBox1.Text = aleatorio(i)
       Next
       For j As Integer = 0 To aleatorio.Length - 1
           aleatorio(j) = r.Next(1, 5)
           TextBox2.Text = aleatorio(j)
           TextBox1.Text = aleatorio(j)
       Next
       For k As Integer = 0 To aleatorio.Length - 1
           aleatorio(k) = r.Next(1, 5)
           TextBox3.Text = aleatorio(k)
           If TextBox2.Text = aleatorio(k) Then
               MessageBox.Show("ganastes")
           End If
       Next
 
 

kasiko:
no es recomendable poner el codigo en los botones... segun los patrones de diseņo  :rolleyes:

Navegación

[0] Índice de Mensajes