how to delete the 2nd last record in a listbox??
i only know listbox.clear which will delete all record in a listbox.
Printable View
how to delete the 2nd last record in a listbox??
i only know listbox.clear which will delete all record in a listbox.
Try this...
VB Code:
listbox.removeitem listbox.listcount-2
thanks...how to cater the last record in a listbox??
i tried this but got an error..
listbox.list(listbox.listcount)
I'm not sure what you mean by 'cater', but if you are attempting to find out how many items are in a listbox, the syntax is:Quote:
Originally Posted by Apek
VB Code:
Msgbox List1.ListCount
now i have 2 combobox..
every item in the combobox that i click will be added in the listbox..
let say i have added 2 items from 2nd combobox,so i want to capture what is the last item in the listbox...if the last item is coming from 1st combobox then it will do nothing but if the last item is coming from 2nd combobox i want to remove it.
Quote:
Originally Posted by Apek
VB Code:
Dim intLastRecord As Integer intLastRecord = List1.ListCount - 1 MsgBox List1.List(intLastRecord)
hack..i just edited my post..maybe you might give different answer
I am so confused. If you are going to remove an item from your last box, then why are you bothering to add it in the first place?Quote:
Originally Posted by Apek
What is your end goal for all of this popping stuff all over everywhere?
actually i think i didn't deliver my problem very well.
i will try again here.
i want to remove it because maybe accidentally i choose a wrong item from the second combobox,and the item go to the listbox.
so i have to choose an item again from the second combobox.
but only one item from each combobox is allowed to be in the listbox.
so thats why i want to remove the last item in the listbox which is wrongly inserted from 2nd combobox.
i hope i clarify enough.if it still not clear i will explain again.
Quote:
Originally Posted by Apek
VB Code:
listbox.list(listbox.listcount-1)