Private Sub cmdStart_Click()
'samples an image at intervals depending on the settings
'of range (number of rows and columns) and stepval (interval
'between pixels) and generates a prnd number by performing
'modular division on the color value of the pixel
Dim nbin As Byte
Dim numbers As String
Dim row As Integer
Dim col As Integer
Dim n As Integer
Dim colcount As Integer
Dim range As Integer
Dim stepval As Integer
Dim modulus As Integer
lncount = 0
numbers = ""
range = Val(txtRange.Text)
stepval = Val(txtStep.Text)
modulus = Val(txtModulus.Text)
'send data to a text file and a binary file
Open "C:\windows\desktop\data\random.txt" For Output As #1
Open "C:\windows\desktop\data\rnd.dat" For Binary Access Write As #2
For row = 100 To range Step stepval
For col = 100 To range Step stepval
n = pboxImage.Point(row, col) Mod modulus
nbin = pboxImage.Point(row, col) Mod modulus
numbers = numbers & Str(pboxImage.Point(row, col)) & vbCrLf
If n > 0 Then
Print #1, n;
Put #2, , nbin
colcount = colcount + 1
If colcount Mod 10 = 0 Then Print #1, vbCrLf
End If
Next col
Next row
Close #1
Close #2
txtNumbers.Text = numbers
End Sub
Private Sub cmdStart_Click()
'samples an image at intervals depending on the settings
'of range (number of rows and columns) and stepval (interval
'between pixels) and generates a prnd number by performing
'modular division on the color value of the pixel
Dim nbin As Byte
Dim numbers As String
Dim row As Integer
Dim col As Integer
Dim n As Integer
Dim colcount As Integer
Dim range As Integer
Dim stepval As Integer
Dim modulus As Integer
colcount = 0
numbers = ""
range = Val(txtRange.Text)
stepval = Val(txtStep.Text)
modulus = Val(txtModulus.Text)
'send data to a text file and a binary file
Open "C:\windows\desktop\data\otpad.txt" For Output As #1
is it possible that the rnd.dat file already exists with the text you
are seeing? If you aren't writing enough bytes to overwrite old data
then it will still be there. try adding
on error resume next
kill "C:\windows\desktop\data\rnd.dat"
on error goto 0
before you open the binary file