题库 题库

【简答题】

 
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 ?
    End If
    If Button = 2 Then
    Text1.Text = InputBox("请输入要删除的项目")
    'For i = 0 To ?
        'If List1.List(i) = ? Then
            'List1.RemoveItem ?
        End If
    Next i
    End If
End Sub

参考答案

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

相关试题