我不断收到“索引超出数组范围”。当我尝试将项目添加到 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]);