|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
why does when adding items to a list box all items are added according to index increment, but when items are removed only even items are removed????
thanks for your help dave ...this is the code Private Sub Command1_Click() Dim Entry, i, Msg ' Declare variables. Msg = "Choose OK to add 100 items to your list box." MsgBox Msg ' Display message. For i = 1 To 100 ' Count from 1 to 100. Entry = "Entry " & i ' Create entry. Debug.Print Entry & " " List1.AddItem Entry ' Add the entry. Next i Msg = "Choose OK to remove every other entry." MsgBox Msg ' Display message. For i = 1 To List1.ListCount ' Determine how to Debug.Print List1.ListIndex Debug.Print List1.ListIndex List1.RemoveItem (i) Next i ' item. Msg = "Choose OK to remove all items from the list box." MsgBox Msg ' Display message. List1.Clear ' Clear list box. End Sub |
|
#2
|
|||
|
|||
|
try this one.
Private Sub Command1_Click() Dim Entry, i, Msg ' Declare variables. Msg = "Choose OK to add 100 items to your list box." MsgBox Msg ' Display message. For i = 1 To 100 ' Count from 1 to 100. Entry = "Entry " & i ' Create entry. Debug.Print Entry & " " List1.AddItem Entry ' Add the entry. Next i Msg = "Choose OK to remove every other entry." MsgBox Msg ' Display message. While List1.ListCount > 0 ' Determine how to Debug.Print List1.ListIndex Debug.Print List1.ListIndex List1.RemoveItem (List1.ListCount - 1) Wend End Sub |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > listbox remove item vb 6.0 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
![]() |
|