Click here to Skip to main content
11,709,536 members (51,254 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# Skype
can somebody please guide me how to generate an event if the date in list box is changed

I am filling the list with all the online users on skype using sky4com library. If a new user comes online i want to update my form and display the new online user too in the listbox. Thanks in advance for any help.

using SKYPE4COMLib;
using System.Runtime.InteropServices;
 List<string> online_users = new List<string>();
 IEnumerable<SKYPE4COMLib.User> users;

            listBox1.DataSource = online_users;

        public void Update_listbox()
            users = skype.Friends.OfType<SKYPE4COMLib.User>();
                .Where(u => u.OnlineStatus == TOnlineStatus.olsOnline)
                .OrderBy(u => u.Handle)
                .ForEach(u =>  online_users.Add(u.Handle));
Posted 11-Jul-13 0:15am
Edited 11-Jul-13 0:17am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

The event should not get generated by the ListBox but some underlying logic. Bind the ListBox to a BindingList[^] instead of a List. Any changes to the list will get displayed without the Update() call.

However, you still need the method known as Update_listbox(). Just name it according to its purpose: changing your bound online users list.

And then again, you need to call it. How is it called now? Does the skype4com library provide an event?

As a last resort, there's always a Timer (or this, or that) to poll the data.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 525
1 OriginalGriff 250
2 Peter Leow 219
3 Maciej Los 185
4 Mika Wendelius 160
0 OriginalGriff 9,428
1 Sergey Alexandrovich Kryukov 9,037
2 CPallini 5,189
3 Maciej Los 4,991
4 Mika Wendelius 3,856

Advertise | Privacy | Mobile
Web01 | 2.8.150819.1 | Last Updated 11 Jul 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100