Search code examples
c#twittertweetsharp

TweetSharp: How do i display username net to the users name in my listView?


Hello im currently trying to fix so that my listview displays 2 columns, one which displays the tweet and the second one displaying the tweets owner(the user). how do i do this? i've come this far:

private void button1_Click(object sender, EventArgs e) {

        listbox1.Items.Clear();
        tweetid.Items.Clear();

        TwitterSearchResult inc = service.Search(new SearchOptions { Q = "stuff", Lang = "en" });
        IEnumerable<TwitterStatus> status = inc.Statuses;


        foreach (var tweet in inc.Statuses)
        {


            ListViewItem item = new ListViewItem(tweet.Text);

            item.SubItems.Add(tweet.Text);
            item.SubItems.Add(tweet.Text);


            listView2.Items.Add(item);

I sorta want to include a new Tweetsharp command in the same variable "tweet". Is this possible. im thinking i have to add a new IEnumerable<>. Any help would be thankfully accepted.

OH AND ONE MORE THING! :)

How come that tweetsharp only returns a 100 tweets max? Is there a way to solve this too? :) Thanks.


Solution

  • one which displays the tweet and the second one displaying the tweets owner(the user)

    Well, taking a quick look at the objects you're using, it appears that TwitterStatus has a User property of type TwitterUser, which itself has a Name property. Does the intellisense disagree with this?

    im thinking i have to add a new IEnumerable<>

    Why? You currently have a collection of TwitterStatus objects, which seem to contain all the information you need. Are you just looking to do this?:

    item.SubItems.Add(tweet.Text);
    item.SubItems.Add(tweet.User.Name);
    

    From that collection (IEnumerable<>) of TwitterStatus objects you are able to extract all the information about those tweets. Just display the information you want to display.