|
-
Dec 2nd, 1999, 12:57 PM
#4
Thread Starter
Member
Hi,
I cut and pasted the codes you all posted. The first code.... not sure what to do. The second code.... there are many repeating words.
Here is my code. Please tell me how to generate random words without repeating any of them!
Thanks,
ROSE
Option Explicit
Dim number As Integer
Dim definitionword(999) As String
Dim wordstring As String
Dim labelp As String
Dim counter As Integer
Dim number1 As Integer
Dim test As String
Dim name As String
dim label
Private Sub Command1_Click()
Dim i As Integer
If UCase(text1.Text) = UCase(label Then 'to test if match
Label3.Caption = "Right" 'display right or wrong
Else
Label3.Caption = "Wrong"
End If
Randomize Timer 'randomize
number1 = Int(Rnd * number)
label = dword(definitionword(number1)) 'randomly words
Label2.Caption = labelp 'displays the definition
imgSign.Picture = LoadPicture(App.Path & "\images\" & label & ".gif") 'load images
Label1.Caption = label 'displays the word
End Sub
Private Sub Form_Load()
Open App.Path & "\description.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, definitionword(counter)
counter = counter + 1
Loop
Close #1
number = counter
End Sub
Private Function dword(word$) As String
name = Trim$(word)
test = InStr(name, " ")
dword = Left$(name, test - 1) 'get first word from the file
labelp = Right$(name, (Len(name) - test)) 'get the phrases after the first word from the file
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|