You will need a variable to keep track of how many friends have been entered.
Dim MyFriendCount As Integer, LoopCounter As Integer
Then you will need to initialize your friend counter
Then you will need to test to see if you haved entered any friends yet...
Dim FoundFriend As Boolean
If MyFriendCount = -1 Then 'no friend have been entered
But if they have then you need to test if you have reached the limit...
ElseIf MyFriendCount > 10 Then 'too many friends or you need to redimension array so notify user...
Then of course if you have not exceeded the friend count...
Else 'need to check to see if you have already entered friend
For LoopCounter = 0 To MyFriendCount
If UCase(Text1.Text) = UCase(Friends(LoopCount)) Then
FoundFriend = True
Else
FoundFriend = False
End If
Next LoopCount
If FoundFriend = True Then
'notify user
Else
MyFriendCount = MyFriendCount + 1
Friends(MyFriendCount) = Text1.Text
End If
End If
Good Luck
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
Offline 1,670 posts
since Mar 2009