注册 登录
编程论坛 VB6论坛

我初学vb,这个编码总是错,请大家帮我看一下错在哪?

淡漠 发布于 2013-03-10 13:53, 639 次点击
Private Sub Form_mousedown(button As Integer, shift As Integer, x As Single, y As Single)
If button = 1 Then
Text1.Text = InputBox("请输入要添加的项目")
'list1.additem=text1.text
End If
If button = 2 Then
Text1.Text = InputBox("请输入要删除的项目")
'for i=0 to list1,listcount-1
'if list1.list(i)=text1.text
'list1.romoveitem i
End If
Next i
End If
End Sub
这个编码,一运行,就缺少next的for语句,我比照的答案的,因为自学,所以也不懂,能麻烦帮我找一下错么?谢谢!
5 回复
#2
Artless2013-03-10 14:17
Private Sub Form_mousedown(button As Integer, shift As Integer, x As Single, y As Single)
If button = 1 Then
Text1.Text = InputBox("请输入要添加的项目")
End If
If button = 2 Then
Text1.Text = InputBox("请输入要删除的项目")
End If
End Sub
#3
SKYYYF2013-03-10 16:11
程序代码:
Private Sub Form_mousedown(button As Integer, shift As Integer, x As Single, y As Single)
If button = 1 Then
  Text1.Text = InputBox("请输入要添加的项目")
  List1.AddItem Text1.Text
End If

If button = 2 Then
  Text1.Text = InputBox("请输入要删除的项目")
  For i = 0 To List1.ListCount - 1
    If List1.List(i) = Text1.Text Then
    List1.RemoveItem i
    End If
  Next i
End If
End Sub
#4
淡漠2013-03-13 14:43
回复 2楼 Artless
谢谢!
#5
淡漠2013-03-13 14:44
回复 3楼 SKYYYF
谢谢
#6
zhengang10262013-03-13 14:55
去掉next i 和最后的end if
1