Sul mio blog troverai un programma che si chiama meganalotto.....in pratica fa quello che vuoi tu....studiati i sorgenti e vedrai che ho risolto il tuo stesso problema con l'uso degli array (o vettori che dir si voglia!)
ha dato un'occhiata al tuo sorgente, ma ho visto che generi le combinazioni in modo casuale
io, invece, voglio generare delle combinazioni specifiche con dei numeri che l'utente scrive in 5 textbox
un mio collega, mi ha dato una mano in questo modo:
PUBLIC SUB Button1_Click()
DIM k, x, y, z AS Integer
K = 6
FOR x = 1 TO (k - 1)
FOR y = (x + 1) TO (k)
FOR Z = (y + 1) TO (k)
ListBox1.Add(x & " " & y & " " & z)
NEXT
NEXT
NEXT
Label1.Caption = ListBox1.Count
END
questo codice, genera 20 terzine che vanno da 1 a 6, ma non è quello che voglio ottenere
DIM array1 AS NEW Integer[]
DIM i, i1, i2 AS Integer
ListBox1.clear
array1.Add(ValueBox1.Value)
array1.Add(ValueBox2.Value)
array1.Add(ValueBox3.Value)
array1.Add(ValueBox4.Value)
array1.Add(ValueBox5.Value)
FOR i = 0 TO array1.Max - 2
FOR i1 = i + 1 TO array1.Max - 1
FOR i2 = i1 + 1 TO array1.Max
ListBox1.add(array1[i] & " " & array1[i1] & " " & array1[i2])
NEXT
NEXT
NEXT