0

Using TweetSharp I am counting the list of followers. How can I withdraw it to the ListBox?

Here is the code:

var options = new ListFollowerIdsOfOptions() { ScreenName = "PutinRF" };
do
{
    if (cursor != null)
      options.Cursor = cursor;

    var followersList = ts.ListFollowerIdsOf(options);

    //listBox1.Items.AddRange(followersList.ToArray());

    cursor = followersList.NextCursor;

} while (cursor != 0);
Broots Waymb
  • 4,713
  • 3
  • 28
  • 51

2 Answers2

1

Try to use DataSource property:

listBox1.DataSource = followersList;

or look at following implementation:

var allIds = new List<long>();
var options = new ListFollowerIdsOfOptions() { ScreenName = "PutinRF" };
var followersIds = ts.ListFollowerIdsOf(options);
while (followersIds.NextCursor != 0)
{
   options.Cursor = followersIds.NextCursor;
   allIds.AddRange(followersIds);
}
listBox1.DataSource = allIds;
Roman Marusyk
  • 23,328
  • 24
  • 73
  • 116
0

My decision:

            var options = new ListFollowerIdsOfOptions { ScreenName = "PutinRF" };
            List<long> All_ods = new List<long>();
            TwitterCursorList<long> followerIDS = ts.ListFollowerIdsOf(options);
            while(followerIDS.NextCursor!=null)
            {
                options.Cursor = followerIDS.NextCursor;

                All_ods.AddRange(followerIDS.ToArray());
                //listBox1.Items.Add(All_ods.ToArray());
                listBox1.DataSource = All_ods;
                label1.Text = "Получено: " + listBox1.Items.Count.ToString();
                break;  
            }