0
我總是收到「索引超出數組邊界」。當我嘗試將項目添加到列表視圖。C#:索引超出了數組範圍的邊界ListView
我在做什麼錯?
這裏是我的代碼:
string[] h = getBetweenAll(thepage, "\" target=\"_blank\">", "</a>");
foreach (string s in h)
listViewClickbank.Items.Add(new ListViewItem(""));
foreach (ListViewItem i in listViewClickbank.Items)
{
if (i.SubItems[0].Text == "(view mobile)")
{
i.Remove();
}
}
foreach (ListViewItem i in listViewClickbank.Items)
{
if (i.SubItems[0].Text.Contains("recordTitle"))
{
i.Remove();
}
}
string[] u = getBetweenAll(thepage, "<div class=\"description\">", "</div>");
for (int i = 0; i < h.Length && i < listViewClickbank.Items.Count; i++)
{
listViewClickbank.Items[i].SubItems.Add(u[i]);
}
在這條線出現錯誤:
listViewClickbank.Items[i].SubItems.Add(u[i]);
謝謝!有效 :) –