|
-
Jul 18th, 2005, 04:27 AM
#1
Thread Starter
Hyperactive Member
delete 2nd last record in listbox.
how to delete the 2nd last record in a listbox??
i only know listbox.clear which will delete all record in a listbox.
-
Jul 18th, 2005, 04:28 AM
#2
Re: delete 2nd last record in listbox.
Try this...
VB Code:
listbox.removeitem listbox.listcount-2
-
Jul 18th, 2005, 05:29 AM
#3
Thread Starter
Hyperactive Member
Re: delete 2nd last record in listbox.
thanks...how to cater the last record in a listbox??
i tried this but got an error..
listbox.list(listbox.listcount)
-
Jul 18th, 2005, 06:45 AM
#4
Re: delete 2nd last record in listbox.
 Originally Posted by Apek
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:
-
Jul 18th, 2005, 06:50 AM
#5
Thread Starter
Hyperactive Member
Re: delete 2nd last record in listbox.
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.
Last edited by Apek; Jul 18th, 2005 at 06:54 AM.
-
Jul 18th, 2005, 06:54 AM
#6
Re: delete 2nd last record in listbox.
 Originally Posted by Apek
no..i want to detect what is the last record in the list...
VB Code:
Dim intLastRecord As Integer
intLastRecord = List1.ListCount - 1
MsgBox List1.List(intLastRecord)
-
Jul 18th, 2005, 08:49 AM
#7
Thread Starter
Hyperactive Member
Re: delete 2nd last record in listbox.
hack..i just edited my post..maybe you might give different answer
-
Jul 18th, 2005, 09:43 AM
#8
Re: delete 2nd last record in listbox.
 Originally Posted by Apek
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.
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?
What is your end goal for all of this popping stuff all over everywhere?
-
Jul 18th, 2005, 07:20 PM
#9
Thread Starter
Hyperactive Member
Re: delete 2nd last record in listbox.
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.
-
Jul 18th, 2005, 08:16 PM
#10
Re: delete 2nd last record in listbox.
 Originally Posted by Apek
thanks...how to cater the last record in a listbox??
i tried this but got an error..
listbox.list(listbox.listcount)
VB Code:
listbox.list(listbox.listcount-1)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|