当我使用循环获取列表视图列名称时,我收到错误,如下所示。
这是我的循环:
For xCnt = 2 To lvHolidays.Columns.Count
strState = lvHolidays.Columns(xCnt).Text
For Each li In fHoliday.lvStates.Items
If strState = li.Text Then
If lvHolidays.SelectedItems(xCnt).SubItems(xCnt - 1).Text = "Yes" Then
li.Checked = True
End If
Exit For
End If
Next
Next
这是错误:
"InvalidArgument=Value of '18' is not valid for 'index'.
Parameter name: index"
答案 0 :(得分:0)
试试这个:
For xCnt = 2 To lvHolidays.Columns.Count-1