Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
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  
Old January 14th, 2004, 09:51 PM
gnanadurai gnanadurai is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: australia
Posts: 2 gnanadurai User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 sec
Reputation Power: 0
Unhappy listbox remove item vb 6.0

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

Reply With Quote
  #2  
Old January 29th, 2004, 05:35 AM
rletanab rletanab is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Philippines
Posts: 21 rletanab User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to rletanab
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

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > listbox remove item vb 6.0


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway