Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21286

Removing specific items from a listbox with their index?

$
0
0
Hello there! I have a list of students in a listbox called StudentList.

I am trying to figure out how I could remove an item by saying removeitem index0 (the first item in the listbox), second item would be list(1), etc

Ex: I have a command button, and when I click on it, it uses the code StudentList.RemoveItem StudentList.List(0), but I get a type mismatch error. There is an item there though in that spot.

What I would like to add after this though, is once an item is removed from the studentlist listbox, the "blank space" that would be left from the removed item, is removed, so for example if I removed list(0) from the list, then the listbox would have the next item list(1) move up to the top, then it would become list(0). Would anyone know how to do that?

Thank you!!!!

Viewing all articles
Browse latest Browse all 21286

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>