'name for Text1 text box, add two names of C1 and C2 respectively command button,
'[for]
'(1) through the properties window to L1 add list item "AAA", "BBB", "CCC",
'(2) set the title of C1 and C2 button respectively "added list item" and "delete list items",
'(3) write the appropriate event process, when the program runs, to the text box input string "DDD"
List, click "add item" button to add the contents of the text box to the list box, click
'" delete list items "the selected list item in a list box to delete,
CodePudding user response:
Generation of homework belongs to charging projectsCodePudding user response:
Programming isOption explicit
Private sub C1_click ()
L1. Additem text1. Text
End sub
Private sub C2_click ()
L1. Removeitem L1. Listindex
End sub
Why when deleting the wrong?
CodePudding user response:
L1. Removeitem L1. ListindexChange
L1. Removeitem 0
Have a try?
Listindex in the absence of selected list elements may be 1.
CodePudding user response:
Try this:Option Explicit
Dim x As Integer
Private Sub C1_click ()
L1. AddItem Text1. Text, L1. ListCount
X=L1. ListCount
End Sub
Private Sub C2_click ()
L1. RemoveItem (x - 1)
X=x - 1
End Sub
CodePudding user response: