ciao come da titolo questo è il codice, il problema è che dopo 80 estrazioni (più o meno) il messaggio "numero già estratto" compare troppe volte. come si può fare che i numeri già estratti vengano tolti dall'intervallo 1, 90 ?
codice:Public Class Form1 Dim numero(90) As Integer Dim casuale As New Random Dim x As Integer Dim y As Integer Dim contatore As Integer = 0 Sub estrazione() x = casuale.Next(1, 90) TextBox2.Text = "" For Each y In numero TextBox2.Text = TextBox2.Text + Str(y) If x = y Then MsgBox(Str(x) + " numero già estratto") estrazione() End If Next End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click estrazione() contatore = contatore + 1 TextBox3.Text = contatore numero(x) = x TextBox1.Text = TextBox1.Text + Str(x) If contatore = 90 Then Panel1.Visible = True End If End Sub End Class

Rispondi quotando