Dim aryName As String() = Nothing
aryName = File.ReadAllLines(Application.StartupPath & "\Random\fnames.txt")
Dim randomWords As New List(Of String)
For i = 0 To aryName.Length - 1
If randomWords.Contains(aryName(i)) = False Then
randomWords.Add(aryName(i))
End If
Next
Dim random As New Random
Label2.Text = (randomWords(random.Next(0, randomWords.Count - 1)).ToString)
該代碼應該從一個txt文件中取出單詞,然後將它們放到一個標籤中,唯一的問題是;這些詞有時會重複。我只希望每個單詞出現一次,但是它們會出現多次。我的代碼有什麼問題? (VB)