hola a todos he resalizado un programa en la cual me genera un archivo y lo muestra en el picture box que guera los 100 preimeros numeros despues los mustra 5 numeros
pero de esos 5 me repinten 2 numeros
ejemplo
4
1
2
4
5
este es el codigo fuente
Private Sub Form_Load()
Me.Command1.Caption = "Generar Archivo"
Me.Command2.Caption = "Mostrar Números"
Me.Picture1.AutoRedraw = True
End Sub
Private Sub Command1_Click()
Dim FSO As New FileSystemObject
Dim tst As TextStream
Dim i As Integer
Set tst = FSO.OpenTextFile("C:\numeros.txt", ForWriting, True)
For i = 1 To 100
Randomize
tst.WriteLine Int(Rnd(1) * 100)
Next i
tst.Close
Set FSO = Nothing
MsgBox "Archivo Generado"
End Sub
Private Sub Command2_Click()
Dim FSO As New FileSystemObject
Dim tst As TextStream
Dim n As String
Dim c As Integer
Set tst = FSO.OpenTextFile("C:\numeros.txt", ForReading, True)
Me.Picture1.Cls
Do Until tst.AtEndOfStream
n = tst.ReadLine
If CInt(n) >= 1 And CInt(n) <= 15 Then
c = c + 1
Me.Picture1.Print n
If c = 5 Then
Exit Do
End If
End If
Loop
tst.Close
Set FSO = Nothing
End Sub
agradezco sus valiosas ayudas