First time poster, please forgive any faux pas.
"...code for a program that asks the user for ten words. The program alerts the user if they enter a word that they have entered before and does not count it against the ten."
This is what I have so far. I can accept and display the numbers, but I cannot figure out how to make the comparison work with an array. The subject matter is 'arrays,' so one is necessary.
Public Class Form1 Dim WORDS(0 To 9) As String Dim holding As String Dim Comp As Short Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Input_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Input.Click Dim i As Short Dim Output As String For i = 0 To UBound(WORDS) holding = InputBox("Words, please.") Comp = (StrComp(holding, WORDS(i))) If Comp = 0 Then MsgBox("Try another word") Else : WORDS(i) = holding End If Next Output = Join(WORDS, ", ") MsgBox(Output) End Sub Private Sub Check() ' For i = 0 To UBound(WORDS) ' If holding = WORDS(i) Then 'InputBox("try a different word") ' Else ' WORDS(i) = holding ' End If 'Next End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Close() End Sub End Class
There are two different attempts here- the one to use 'StrComp' and the 'Check' Sub. Any advice would be appreciated.