回 帖 发 新 帖 刷新版面

主题:红色部分

Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
        Dim friends(4) As String
        friends(0) = "jonathan"
        friends(1) = "TRichard"
        friends(2) = "Thearon"
        friends(3) = "Sharon"
        friends(4) = "Micheal"
        Dim morefriends(1) As String
        morefriends(0) = "Zita"
        morefriends(1) = "Seth"
        [color=FF0000]AddFriendsToList(friends)
        AddFriendsToList(morefriends)[/color]        Dim friendName As String
        For Each friendName In friends
            lstFriends.Items.Add(friendName)
        Next
    End Sub
    Sub AddFriendstToList(ByVal friends() As String)
        Array.Sort(friends)
        Dim friendname As String
        For Each friendname In friends
            lstFriends.Items.Add(friendname)
        Next
    End Sub
红色部分有错,请问错在那里

回复列表 (共4个回复)

沙发

Call AddFriendsToList(friends)
或者AddFriendsToList friends

语法问题

板凳

To FancyMouse:

VB.Net中必须加参数括号,语法上没有问题。

3 楼

 Sub AddFriendstToList(ByVal friends() As String)
        Array.Sort(friends)
        Dim friendname As String
        For Each friendname In friends
            lstFriends.Items.Add(friendname)
        Next
End Sub
看定义是AddFriends[b]t[/b]ToList,多了个t

4 楼

看错诶……不好意思

我来回复

您尚未登录,请登录后再回复。点此登录或注册