ラベルを持っています。リストがあります。「label1.Text = match.Value;」を実行すると、ボタンをクリックするたびに変化する 1 つの文字列とは対照的に、リストの最後の項目が表示されます。コードは次のとおりです。
private void frontPageToolStripMenuItem_Click(object sender, EventArgs e)
{
const string url = "http://reddit.com/r/pics";
var source = getSource(url);
var regex = new Regex([regex removed]);
var links = new List<string>();
var titles = new List<string>();
foreach (Match match in regex.Matches(source))
{
links.Add(match.Groups[1].Value);
titles.Add(match.Groups[2].Value);
}
foreach (var title in titles)
{
label1.Text = title; /*it just shows the last 'title' in 'titles', I want it to start at the first, and go to the next title every time the event occurs (frontPageToolStripMenuItem_Click)*/
}
}
前もって感謝します!