private sub command1_click()
dim str as string
command1.visible = false
randomize timer
str = ""
open "c:\vb.txt" for output as #1
while j < 10
q = int(rnd(1) * 369 + 1)
label1.caption = q: doevents
if n(q) = 0 and bstop = true then
str = str & q & chr(13) & chr(10)
n(q) = 1
j = j + 1
bstop = false
end if
wend
if str <> "" then
print #1, str
end if
close #1
end sub