Can someone see what i did wrong here chapter 6
I keep getting the blue squiggles for the coma beside darren" and one on friends in the AddFriendsToList function. Does anyone have an idea? Here is the source that I thought you'd probably need to see:
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
'Define an array to hold friends in...
Dim friends() As String = ("Darren", "Edward", "Alex", _
"Charlotte","Len")
'show the friends...
AddFriendsToList(friends)
End Sub
Sub AddFriendsToList(ByVal friends() As String)
'find upper and lower bounds of array using
'Ubound and Lbound methods...
MessageBox.Show("Upper bound: " & UBound(friends), "Array Demo")
MessageBox.Show("Lower bound: " & LBound(friends), "Array Demo")
' sort list
Array.Sort(friends)
'how big is the array?
'use length method to find out total of array
'insert - 1 to get highest number array supports
Dim upperBound As Integer = friends.Length - 1
' go through each friend...
' index variable represents the numbers assigned in array
Dim index As Integer
For index = upperBound To 0 Step -1
'add each on to the list...
lstFriends.Items.Add(friends(index))
Next
End Sub
End Class
|