永发信息网

VB.net问题,为什么会提示错误。

答案:2  悬赏:30  手机版
解决时间 2021-01-23 15:05
  • 提问者网友:孤凫
  • 2021-01-23 01:07
我只不过是想得到索引,看下面代码,为什么会提示错误
Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
If ListView1.Items.Count > 0 Then
Me.Text = ListView1.SelectedItems(0).Index
End If
End Sub
提示错误:InvalidArgument=“0”的值对于“index”无效
最佳答案
  • 五星知识达人网友:鸠书
  • 2021-01-23 02:37
改一下:
If ListView1.SelectedItems.Count > 0 Then
Me.Text = ListView1.SelectedItems(0).Index
End If
全部回答
  • 1楼网友:轻熟杀无赦
  • 2021-01-23 03:25

    listview1.items.add("222")     listview1.items(0).subitems.add("333")

因为你根本就没有第二个subitem

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯