Visual Basic - Eleccion al azar

Life is soft - evento anual de software empresarial
 
Vista:

Eleccion al azar

Publicado por Carlos (10 intervenciones) el 23/10/2005 16:09:39
Hola usuarios, quiero saber como puedo realizar un sistema de numeros al azar en visual, teniendo como ejemplo una funcion que me permita digitar un cmd y ver tres numeros del 1 al 50 sin repetir, como un sorteo de loteria. Gracias de anticipado.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Eleccion al azar

Publicado por christian rodriguez (1 intervención) el 26/10/2005 02:02:36
Necesitas

un form
tres labels --> Nombres por defecto Label[x]
un CommandButon --> Nombre por defecto CommandButton

----------------------

Private Sub Command1_Click()
Dim num1 As Integer
Dim num2 As Integer
Dim num3 As Integer

Randomize
num1 = Int((50 * Rnd) + 1)

Do
Randomize
num2 = Int((50 * Rnd) + 1)
DoEvents
Loop While (num2 = 1)

Do
Randomize
num3 = Int((50 * Rnd) + 1)
DoEvents
Loop While (num3 = 1 Or num3 = 1)

Label1.Caption = num1
Label2.Caption = num2
Label3.Caption = num3
End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar