按删除键可以删除选定了那行,再按一下就会出错。怎样让它在删除一行后,跳到下一行呀Private Sub List1_keypress(KeyAscii As Integer)
If KeyAscii = 8 Or KeyAscii = 46 Then
Text1.Text = 2
List1.RemoveItem List1.ListIndex
End If
End Sub
vb list删除选定行后自动跳到下一个
答案:2 悬赏:80 手机版
解决时间 2021-01-26 00:34
- 提问者网友:像風在裏
- 2021-01-25 19:42
最佳答案
- 五星知识达人网友:英雄的欲望
- 2021-01-25 20:53
Private Sub List1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 46 And List1.ListIndex > -1 Then
a = List1.ListIndex
List1.RemoveItem List1.ListIndex
If a <> List1.ListCount Then
List1.ListIndex = a
Else
List1.ListIndex = a - 1
End If
End If
End Sub
If KeyCode = 46 And List1.ListIndex > -1 Then
a = List1.ListIndex
List1.RemoveItem List1.ListIndex
If a <> List1.ListCount Then
List1.ListIndex = a
Else
List1.ListIndex = a - 1
End If
End If
End Sub
全部回答
- 1楼网友:酒醒三更
- 2021-01-25 21:53
'删除选中list
for i = 0 to list1.listcount - 1
if i = list1.listcount then exit for
if list1.selected(i) then
text1.text = replace(text1.text, list1.list(i) & vbcrlf, "") //删除对应text里的行
list1.remove(i)
i = i - 1
end if
next
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯