【问题标题】:How can I load Skype user information into a ListBox?如何将 Skype 用户信息加载到 ListBox 中?
【发布时间】:2013-06-18 00:17:38
【问题描述】:

所以我一直在 VB.NET 中开发这个程序,它可以获取用户的 Skype 信息,例如句柄、生日、电话号码等。但是我找不到将特定用户信息加载到 ListBox 中的方法。这是我的代码

    Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
    For Each hmm As SKYPE4COMLib.User In Skype.Friends
        ListBox2.Items.Add("<>-----------------------------------------<>")
        ListBox2.Items.Add(hmm.FullName)
        ListBox2.Items.Add(hmm.Handle)
        ListBox2.Items.Add(hmm.Sex)
        ListBox2.Items.Add(hmm.PhoneHome + hmm.PhoneMobile + hmm.PhoneOffice)
        ListBox2.Items.Add(hmm.Aliases)
        ListBox2.Items.Add(hmm.Birthday)
        ListBox2.Items.Add(hmm.City)
        ListBox2.Items.Add(hmm.Country)
        ListBox2.Items.Add(hmm.Language)
        ListBox2.Items.Add(("Friends: ") & hmm.NumberOfAuthBuddies)
        ListBox2.Items.Add("<>-----------------------------------------<>")
    Next
End Sub

唯一的问题是,当我点击 Button8 时,它会将我所有的联系人信息加载到 ListBox 中,我只想在我的 TextBox3 中加载用户名信息。

这是一个视觉效果:

图中的TextBox是TextBox3,带有文本“Get”的按钮是Button8,ListBox是ListBox2。如何让 ListBox2 从 TextBox3 中加载用户名信息?

【问题讨论】:

    标签: vb.net api textbox listbox skype


    【解决方案1】:

    你可以这样做..但不要对 ListBox2 进行排序!

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim lstHandle as New List(Of String)
    Dim lstSex as New List(Of String)
    Dim lstPhone as New List(Of String)
    Dim lstAlias as New List(Of String)
    Dim lstBDay as New List(Of String) '--> you can change to date
    Dim lstCity as New List(Of String)
    Dim lstCountry as New List(Of String)
    Dim lstLang as New List(Of String)
    Dim lstFriend as New List(Of String) '--> you can to integer
    
    For Each hmm As SKYPE4COMLib.User In Skype.Friends
        'ListBox2.Items.Add("<>-----------------------------------------<>")
        ListBox2.Items.Add(hmm.FullName)
        lstHandle.Add(hmm.Handle)
        lstSex.Add(hmm.Sex)
        lstPhone.Add(hmm.PhoneHome + hmm.PhoneMobile + hmm.PhoneOffice)
        lstAlias.Add(hmm.Aliases)
        lstBDay.Add(hmm.Birthday)
        lstCity.Add(hmm.City)
        lstCountry.Add(hmm.Country)
        lstLang.Add(hmm.Language)
        lstFriend.Add(("Friends: ") & hmm.NumberOfAuthBuddies)
        'ListBox2.Items.Add("<>-----------------------------------------<>")
    Next
    End Sub
    
    Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
      Dim x as Integer = ListBox2.FindStringExact(TextBox3.Text)
    
      If x > -1 then
        Msgbox( _
        ListBox2.Items.item(x) & vbCrLf & _
        lstHandle(x) & vbCrLf & _
        lstSex(x) & vbCrLf & _
        lstPhone(x) & vbCrLf & _
        lstAlias(x) & vbCrLf & _
        lstBDay(x) & vbCrLf & _
        lstCity(x) & vbCrLf & _
        lstCountry(x) & vbCrLf & _
        lstLang(x) & vbCrLf & _
        lstFriend(x))
      Endif
    End Sub
    

    希望这会有所帮助,您可以改进它!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-03
      相关资源
      最近更新 更多