I got stuck on a problem for so long and I really need your help. So my project is using Twitter API and my goal is to show specific tweets on win forms: after using the API I'm getting an Array and each object inside the array contain a text section with the string that represents the tweet as you can see here: enter image description here
So I wrote: textBox2.Text = tweets5[0].Text; and each time the textbox shows one tweet at a time and I want it to show all of them together on that textbox.
I tried to use for but the signature of the method is: enter image description here
I tried to print the length, tried foreach, tried while and nothing seems to work...
Thanks a lot for your time!
There are many ways you can accomplish this. I'll suggest one:
You could loop through your array and append the text each time to a StringBuilder.
StringBuilder AllText = new StringBuilder(tweets5[0].Text + Environment.NewLine);
for (int i = 1; i < tweets5.Count; i++)
{
AllText.Append(tweets5[i].Text + Environment.NewLine);
}
TextBox.Text = AllText.ToString();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.