Foreach loop XmlNodeList

I know that there is already a marked answer, but you can do it like you did in your first try, you just need to replace the int with XmlNode

XmlDocument xDoc = new XmlDocument();
xDoc.Load("http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=twitter");

XmlNodeList tweets = xDoc.GetElementsByTagName("text");
foreach (XmlNode i in tweets)
{
    if (i.InnerText.Length > 0)
    {
         MessageBox.Show(i.InnerText);
    }
}

tweets is a node list. I think that what you're trying to do is this:

XmlDocument xDoc = new XmlDocument();
xDoc.Load("http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=twitter");

XmlNodeList tweets = xDoc.GetElementsByTagName("text");
for (int i = 0; i < tweets.Count; i++)
{
    if (tweets[i].InnerText.Length > 0)
    {
        MessageBox.Show(tweets[i].InnerText);
    }
}