Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Listview Selected Items


hey i was wondering if it is possible to retrieve a collection of selected items from a listview which has multiselect set to true

(not checked, but selected)

i was hoping i could do something like this ...


Code:
dim li as listitem
for each li in listview1.selecteditems
' do something
next li
... but it doesn't appear to be so easy

any hints ?

thanks,

huby.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Getting Value Of Selected Items In Listview
Hey ya'll,

I'm trying this code for :

when user selects multiple rows in a listview and then wants them printed on one printout! (that's the idea anyhow!)

code :

Dim X As Object
Dim i As Integer
Dim db As Database
Dim rs As Recordset
Dim vaOsTime As String
Dim vaOsDate As String
vaOsTime = Time
vaOsDate = Date
If ListView1.SelectedItem Is Nothing Then Exit Sub
For i = 1 To ListView1.ListItems.Count
If ListView1.ListItems(i).Selected = True Then
Dim strSource, strCaption, strText As String
Dim strFooker As String
Dim strDBName As String
Dim strPepp0, strPepp2, strPepp3
strDBName = DBPath()

strFooker = ListView1.ListItems(i).SubItems(1)

strSource = "SELECT * FROM Class4 WHERE Detalj
LIKE '" & strFooker & "'"

End If
Next i

ActiveClassView.DAODataControl1.DatabaseName = strDBName
ActiveClassView.DAODataControl1.RecordSource = strSource
ActiveClassView.Label14 = Date
ActiveClassView.Label15 = Time
ActiveClassView.Printer.Orientation = ddOLandscape
ActiveClassView.Show


Users only get the first row selected printed, can anyone help me to get all rows selected printed?

//Patrick

Getting Selected Items In ListView?
Hi All,

Here's the deal: I have a TreeView and a ListView that operate just like Explorer. I'm trying to loop through the contents of my ListView for any given directory and if an item is selected then I want to add the name of the item to an array (In most cases, just file names). Sounds simple

The problem is that when I have this for example:
ListView Contents
Code:
FolderOne
FolderTwo
FileOne
FileTwo
FileThree
 
If I were to select the three files and attempt to perform the code below this is whats happends.--> The first file is added to the array (good). On the second time through the For/Next loop it seems that the 'Selected' item is now 'FolderTwo' instead of 'FileTwo' (bad). Does this make sense?!? (see the code below)

Code:
    Dim i As Integer
    Dim FSO As Object
    Dim FileChg As Object
    Dim FilesToChange() As String
    Dim H As Integer
    Dim FilePath As String

    Form1.MousePointer = 11
    'Set the File System Object
    Set FSO = CreateObject("Scripting.FileSystemObject")
    
    'Get the path of the selected files
    FilePath = Mid(TreeView1.SelectedItem.FullPath, 23, 2) & Mid(TreeView1.SelectedItem.FullPath, 26)
    Debug.Print FilePath
    
    'loop through the listview items and count the selected ones
    H = 0
    For i = 1 To ListView1.ListItems.Count
        If ListView1.ListItems(i).Selected = True Then
            H = H + 1
        End If
    Next
    
    Debug.Print H
    
     'redim the array to the number of selected files
    ReDim FilesToChange(1 To H) As String

     'loop through the files in the filelistbox and for the selected files
    'add them to the array
    H = 1
    For i = 1 To ListView1.ListItems.Count 'On the second time through I have the problem stated above
        If ListView1.ListItems(i).Selected = True Then
            Debug.Print ListView1.ListItems.Item(i)
            FilesToChange(H) = "" & ListView1.ListItems.Item(i)
            H = H + 1
            Debug.Print FilesToChange(H)
        End If
    Next
 

Thx

Cyphin
~Of all the things I've lost, I miss my mind the most.~
~Iz vseh veshei chto ya poteryal, ya bol'she vsego skuchayu po rassudku.~


Edited by - Cyphin78 on 8/22/2003 10:56:35 AM

Getting ALL The Selected Items From A Listview
Ok, so I've got a ListView in Report mode, and im trying to get the keys of all the selected items in the ListView.

My original code just loops through all the items, and records the selected ones...

Code:

ReDim sDBIDs(0)
     
For x = 1 To grdItems.ListItems.Count
    
    If grdItems.ListItems(x).Selected = True Then
        
        If sDBIDs(0) = "" Then
            
            sDBIDs(0) = grdItems.ListItems(x).Key
        
        Else
            
            ReDim Preserve sDBIDs(UBound(sDBIDs()) + 1)
            sDBIDs(UBound(sDBIDs)) = grdItems.ListItems(x).Key
        
        End If
        
    End If
        
Next x



like so. Its currently fired from the MouseUp event, so that clicking a single item or using the "SHIFT + Click" or "CTRL + Click" method of selecting multiple items both run the code.

Problem is, this doesnt work for Drag selecting items, because for some reason the MouseUp event isnt fired in that case.

So 2 questions really...

1/ how do i get the code to fire when drag selecting

2/ Is there an easier/faster/less brute force method of doing it.

Cheers

Xeno

Get The Selected Items In Listview
hi all.
whats the way of getting all the selected items(multiselect=true) in a listview?
do i have to iterate all of the items in my listview???
thanks.

Identifying Selected Items In A Listview
Hello all,
I have a listview set to multiselect. In VB code how can you identify each record that has been selected/highlighted? I know how to identify individual selected items but not multiple.

Thanks in advance!

-Chadzuk

Determining No Selected Items In A Listview
I have two listviews, you can select one item between the two othem and I need to know how to determine which view has the selected item in. I can think of a round about way of determining (add a global variable that says which is selected with the itemclick event) but would rather know the proper way.

Print Listview Selected Items
hi ,please help.how to print all the selected items in a listview??

thanks for help.

Highlight Selected Items In The Listview
I have DT Picker and use listview to display the date and the activities.. When I pickup the date from DTPicker, It list the date and the activities in the listview

For example when I pickup the 27/7/2007 from DTPicker, It list the date 27/7/2007 in the listview. How I can highlight the that date in the listview?



Code:
On Error Resume Next
Dim newDate As Date
Dim newDate1 As Date
rec.MoveFirst
Do Until rec.EOF
If rec("hari") = "" Then


Set lvItem = lvJadual.ListItems.Add(, , "")
lvItem.ListSubItems.Add , , "" & rec("end_date")
lvItem.ListSubItems.Add , , "" & rec("peruntukan")
lvItem.ListSubItems.Add , , "" & rec("aktiviti")
lvItem.ListSubItems.Add , , "" & rec("sasaran")
lvItem.ListSubItems.Add , , "" & rec("jenisinput")
lvItem.ListSubItems.Add , , "" & rec("tindakan")
'lvItem.ListSubItems.Add , , "" & rec("hari")

'Isnull(rec("hari")) ialah test untuk tengo kalau nilai yang dibaca dpd field hari ialah null atau kosong
ElseIf IsNull(rec("hari")) Then



Set lvItem = lvJadual.ListItems.Add(, , "")
lvItem.ListSubItems.Add , , "" & rec("end_date")
lvItem.ListSubItems.Add , , "" & rec("peruntukan")
lvItem.ListSubItems.Add , , "" & rec("aktiviti")
lvItem.ListSubItems.Add , , "" & rec("sasaran")
lvItem.ListSubItems.Add , , "" & rec("jenisinput")
lvItem.ListSubItems.Add , , "" & rec("tindakan")
'lvItem.ListSubItems.Add , , "" & rec("hari")
Else
newDate = DateAdd("d", rec.Fields("hari").Value, DTPicker1.Value)
rec.Fields("start_date").Value = newDate
'rec.Fields("start_date").Value = Format(newDate, "dd/MM/yyyy")
newDate1 = DateAdd("d", rec("peruntukan") - 1, rec("start_date"))
'newDate1 = DateAdd("d", rec("peruntukan") - 1, newDate)

' rec("end_date") = Format(newDate1, "dd/MM/yyyy")
rec.Fields("end_date").Value = newDate1


Set lvItem = lvJadual.ListItems.Add(, , "" & Format(newDate, "dd/MM/yyyy"))
lvItem.ListSubItems.Add , , "" & (Format(newDate1, "dd/MM/yyyy"))
'lvItem.ListSubItems.Add , , "" & rec.Fields("end_date").Value
lvItem.ListSubItems.Add , , "" & rec.Fields("peruntukan").Value
lvItem.ListSubItems.Add , , "" & rec.Fields("aktiviti").Value
lvItem.ListSubItems.Add , , "" & rec.Fields("sasaran").Value
lvItem.ListSubItems.Add , , "" & rec.Fields("jenisinput").Value
lvItem.ListSubItems.Add , , "" & rec.Fields("tindakan").Value



rec.Update
End If
rec.MoveNext
Loop

Remove Selected Items In The Listview.
How I can remove the selected items in the listview?


Code:
For i = 1 To ListView1.ListItems.Count
If ListView1.ListItems.Item(i).selected Then

'what should I put here

End If
Next i

Multiple Selected Items In A Listview
Hello, how can I find out how many selected items there are in a listview?

I'm showing a popup menu when the user right-clicks on an item, but I need to know if only 1 item is selected, so I can disable a menu option.

I've tried this, but it doesn't work.


VB Code:
If ListView.SelectedItem < 2 Then mnuCopyMultiple.Enabled = False

ListView First Column Items Selected
Hi Everyone,

How can I detect when a user has selected items from the first column only in a ListView? I would appreciate any help. Thank you.

Determining No Selected Items In A Listview
I have two listviews, you can select one item between the two othem and I need to know how to determine which view has the selected item in. I can think of a round about way of determining (add a global variable that says which is selected with the itemclick event) but would rather know the proper way.

Setting Listview To No Items Selected
Is there a command to make a listview think that nothing is selected in it (as if its just been populated and never clicked on)?
Thanks

Count Selected Items In A ListView
This is making me crazy. There is no ListView ListCount. I can't figure out how to get the number of items selected in a ListView control.

Anyone?

ListView HighLight Of Selected Items
Dear All,

I am attempting to convert some ListBoxes to more interesting ListView controls. When a ListBox looses focus its selected items (rows) remain highlighted, but I am finding the highlight disappears in the ListView.

Is there a way to maintain highlight of selected items in the ListView control when focus is not on it.

regards Hugh,

Number Of Selected Items In Listview Wrong
Hi guys,

I'm working with a listview and i think it works wrong. If the user clicks on an empty row then will be another (not empty) automatically selected. Does someone observe this strage behaviour? I've tried to found the error and I find out that already

GetSelCountListView = SendMessage(lvw.hwnd, LVM_GETSELECTEDCOUNT, 0, 0)

returns a wrong value.

Sorry for my bad english and thanks for every help.

Move Selected Listview Items Up/down/top/bottom
Hello, does anybody know how to move the selected items in a Listview up, down, to the top, to the bottom? Including subitems, keys, tags, etc.

How To Move Multiple Selected Items To New ListView
I have 2 ListView Controls. I need to move multiple selected items from ListView1 to ListView2.

How would I go about doing this?

ListView With Checkboxes (capturing Selected Items)
Hi

I have a listview control with checkboxes and i want to capture those items that the user has checked. The multiselect property is set to true and the listview has a report view which is displaying FileName, Path, File Size, Date Modified - Column headers.
Can someone please help me on this one...

Thanx in advance....

How To Print User Selected Items From Listview
Hi,

Anybody can help me here.

Tq

Determine Selected Items Using Listview.MultiSelect = True
How do you determine which listview items have been selected with multi select on?

Help: How To View Selected Items From Listview With Crystal Report Viewer
Hi

I have a Listview with check boxes from it want to view selected items with crystal report viewer.

Private Sub cmdView_Click()
Dim lCustomerId as Long
    Dim tmpItm As ListItem
    For Each tmpItm In lstItems.ListItems
        If tmpItm.Checked = True Then
            lCustomerId = Val(Replace(tmpItm.Key, "C", ""))
          End If
    Next

  End Sub

Plz. help

regards

Saving Items (selected Items) In List Box To A Text File
I need help in coding the following:

1. Saving (or exporting) the items displayed in List Box to a text file.

2. I have a long list of data to be displayed. When I use this List box all of my data does not fit into the width. I was wondering if there is similar other way where I can do horizontal as well as vertical scrolling. I tried text box and its of no help i guess.

[Resoved] Listview.Selected=Listbox.Selected
I have Listview1 and Listbox1, both with the same exact items and both set to MultiSelect=True. When the user selects mulitple items in the Listview I want the same items to be selected in the Listbox. Can anyone help with this?

Keep Listview Selected Item Selected
I've been searching the site this morning and I've seen this question asked numerous times and the answer appears to be no. I thought I'd try again in case there is a fresh set of eyes out there.

I'm working on a preexisting production form and the person that designed it coded a series of combo boxes next to a series of listviews as user controls. When a combo box loses focus the selected item remains the default selected blue color. When the listview loses focus the selected item's color is a light gray.

I would like the listview selected item to remain blue like the combo boxes so the appearance is uniform.

The user community has lived with this for quite some time so I can't justify the time to rework the form. But if someone knows how to keep the selected item blue when the listview loses focus I'll plug it in though.

Selected Items????
I have many items in a listview and i want to get the list of selected items in the list view.
Currently i m traversing from the whole list and checking if every item.selected property is true.
Problem is it takes time in case of large number of items.
Selected item just gives me the last selected item.It cant be of any use to me .
Any other solution???

Using Listbox Selected Items
ok so I have a listbox with several items and I want to do a msgbox on what item is selected in the listbox. How can I do so?

Items Not Being Selected Properly...
Okay I have two listboxes; lstA and lstB. There are say 10 items in each. I select one item in lstA, then another. This works fine. Then I select an item in lstB. The code I've written takes away selection of any items in lstA at the same time.

The problem is that the first time I click an item in lstA, the item is not selected properly. It doesn't have a solid blue block around it, it just has a dotted rectangle around it.

Here's my code:

Code:
Private Sub lstA_Click()
For X = 0 To lstB.ListCount - 1
lstB.Selected(X) = False
Next X
End Sub

Private Sub lstB_Click()
For X = 0 To lstA.ListCount - 1
lstA.Selected(X) = False
Next X
End Sub
I've also tried setting the .ListIndexes to -1, which produces the exact same result.

...Help!!

Selected Items On A List...
Im trying to find if an item on a list is selected, and if an item is selected i want to get the index number and the item. im trying stuff using list1.selected, but it always gives me errors. Also how do you save the items in a listbox into a text file and reload it back to the form in the list form, i dont understand that.

Items Not Yet Selected From Arrays
Hello,

I'm trying to figure out how to tell which items in an array have not yet been chosen via a listbox. The multiselect property is set to 0, so only one item at a time can be selected. When one is selected a question is asked in a Lookup box. If they get it right they can select another item from the array.

If the user tries to leave the form before having selected all the items and attempted to answer the question, I want to tell them how many items have not been selected, and which is the lowest one they have not selected.

Any ideas on how I do this???

As always, thanks for your help!
tsallGood

--If life serves you lemons...
Ask for salt and a bottle of tequila

How To Add Selected Items To Array
hello i was wondering how can i get all of the selected items from a listbox and place them into an array that is undeclared?

thanks in advance

Removing Selected Items From A List
Hey guys...I'm having a few problems removing selected items from a list. I've tried this a number of different ways, without any joy; i wonder if anybody could point me in the right direction. Here's what i've got:


Code:
For LoopCount = 0 To lstCrit1.ListCount - 1
Set SelectedRows =_
Intersect(Collected.EntireRow,Range("s:s").Offset(ColumnOffset:=LoopCount).Find("*"))
If SelectedRows Is Nothing Then
lstCrit1.RemoveItem (LoopCount)
End If
Next LoopCount
Collected and SelectedRows are ranges, and I want to remove the list item if the range SelectRows is empty. .

Thanks in advance,

Adam

Combo Selected Items Into Listbox
I need help with an assignment I trying to populate my list box after the user clicks on the room number in my classroom scheduler project. How would I do this. I have attached my project for your review.

After I have assign the courses to the room number how can I make them go into list box the ones that where assigned when I select the room number. Also how can I clear one of the classes from the listbox after it has been populated Thanks for any assistance.

[help] Displaying Selected Items In A Listbox
Hey all I need help getting Items from my Treeview checkbox when selected to be placed into a Listbox...TIA

Code:
Private Sub Form_Load()
'
' setup a dummy treeview
'
TreeView1.Checkboxes = True
TreeView1.Nodes.Add , , "Root", "Root"
TreeView1.Nodes.Add "Root", tvwChild, "Child1", "Child1"
TreeView1.Nodes.Add "Root", tvwChild, "Child2", "Child2"
TreeView1.Nodes.Add "Root", tvwChild, "Child3", "Child3"
TreeView1.Nodes.Add "Root", tvwChild, "Child4", "Child4"

TreeView1.Nodes.Add "Child1", tvwChild, "Child1-1", "Child1-1"
TreeView1.Nodes.Add "Child1", tvwChild, "Child1-1-2", "Child1-1-2"
TreeView1.Nodes.Add "Child2", tvwChild, "Child2-1", "Child2-1"
TreeView1.Nodes.Add "Child3", tvwChild, "Child3-1", "Child2-1"
TreeView1.Nodes.Add "Child4", tvwChild, "Child4-1", "Child2-1"

TreeView1.Nodes(1).Expanded = True

TreeView1.Nodes.Add "Child1-1", tvwChild, "Child1-1-1", "Child1-1-1"
TreeView1.Nodes.Add "Child2-1", tvwChild, "Child2-1-1", "Child2-1-1"
TreeView1.Nodes.Add "Child3-1", tvwChild, "Child3-1-1", "Child2-1-1"
TreeView1.Nodes.Add "Child4-1", tvwChild, "Child4-1-1", "Child2-1-1"
TreeView1.Nodes(1).Expanded = True
End Sub
'
' ENulerate the children of a checked node
'
Private Sub TreeView1_NodeCheck(ByVal Node As MSComctlLib.Node)
Dim NodeNext, NodeLast, Child
Dim nodx As Node

' MsgBox "Node has " & Node.Children & " Children."

If Node.Children <> 0 Then
Child = Node.Child.Key
End If

If Node.Checked = True Then
ss = "True"
Else
ss = "False"
End If
If Node.Children <> 0 Then
With TreeView1
NodeNext = .Nodes(Child).FirstSibling.Key
NodeLast = .Nodes(Child).LastSibling.Key
Do While (NodeLast = NodeLast)

.Nodes(NodeNext).Checked = ss
Set nodx = .Nodes.Item(.Nodes(NodeNext).Index)
If nodx.Children <> 0 Then
Call TreeView1_NodeCheck(nodx)
End If

If NodeNext = NodeLast Then Exit Do

NodeNext = .Nodes(NodeNext).Next.Key
.Nodes(NodeNext).Checked = ss
Loop
End With
ElseIf Node.Children = 0 Then
Call parent_check(Node)
End If

If Node.Checked = False Then
Call parent_check(Node)
End If

End Sub
Private Sub parent_check(Node)
Dim nodx As Node
Set nodx = Node.Parent
nodx.Checked = False
If nodx = "Root" Then
Exit Sub
Else
Call parent_check(nodx)
End If
End Sub

Query Only Selected Items In List Box
Is this feasible?

Query selected items in a list box, retrieve info, add additional info, insert all to Oracle database?

Example:

User selects 3 out of 5 names in a list box.
User pulls the address of the 3 names from Oracle table A (Fields: Name, Address).
User wants to enter Name, Address, phone number (entered manually) into Oracle Table B (Fields: Name, address, phone number).


Thanks!

How To Get Selected Items In A Listbox - Help Needed
pls how can you get the selected items in a listbox;
say you have a listbox that has the Multi-select property set to true -
if your listbox have like 30 items in it and the user selected 1 - 12 or still better all
how can you get the value(text)/ItemData of the selected items.

thanks in advance

Combobox Items Disabled When Selected
Greetings from Holland all,

Here is my problem
User selects in a combobox an item (eg "A"). This item will be
captured in a variable and the user can select another item.
When the combobox drops down, the item "A" should be visible, but disabled, because user may not select "A" for a second time.

How do I manage that????
Thanks in advance.

Ger

No Items Selected In A Listbox? *RESOLVED*
I have 2 listboxes side-by-side. When I click on one, I want the "selection" in the other to disappear. I've looked that the controls and played around with it a bit, and I can't figure it out...

2 Listbox's Items Selected At The Same Time?????
Hai,

I am having two list boxes, List1 and List2, when an item in List1 is selected, then the same item must me selected in List2 also.

Basically, i have something like this:

VB Code:
List1         List2-10            10-09            11-13            17-14            15

So if the second item in list1 is selected then the same item, that is the second item, of list2 must me selected.

In addition to this, there is a label control, whose caption property is the item number selected. Any change in selection in list box should refresh the label control.

How can this be done ???????

Any ideas/codes/comments highly appreciated...,

ashky.

Removing All Selected Items (Resolved)
Can I remove all selected items (multiselect) in a listview called lsvList?

Listbox Help - Count Selected Items
Hi, I assume this have been asked and answered before, but can't seem to find any info on this.. How do you get the number of selected items in a listview without having to loop through all the records?
Thanks
John

Count Number Of Selected Items?
Hi,

How can I tell how many items are selected in a listview?

ListView.SelectedItem does not seem to have a "Count" event...

Thanks,

Dan

Remove Non Selected Listbox Items
I have a list box which allows you to select multiple items. I'd like to then have the option of removing all items that are not selected.

Here is what I have...


Code:

'remove any non selected items
For i = 0 To lstOccup.Items.Count - 1
found = False
For j = 0 To lstOccup.SelectedItems.Count - 1
If lstOccup.Items(i).ToString = lstOccup.SelectedItems(j).ToString Then
found = True
End If
Next
If found = False Then
lstOccup.Items.RemoveAt(i)
End If
Next



This doesn't work because once I use RemoveAt it means the for loops no longer work.

Listbox Items Selected Via Checkbox
Hi to all,

I have been searching for a simple way to identify all items checkedwithin a listbox populated by a SQL query but am having difficultytranslating that info the way I need.



Specifically, I've set up a cmd button to process the checked items,which is supposed to edit the corrolating existing database recordset ofthat item. I'm using the ItemData property of the list items to identifywhich database records to modify and am repositioning the data controlto match, but when I use the lst.selected(i) method to determine whichlist items are checked I wind up with only the last highlighted listitem with updated database info and not the actual checked items.



I've searched for a method to determine if a VB6 listbox can identifychecked items other than with the 'selected' method since using'selected' seems to cause some confusion between highlighted andchecked, but I've come up dry. This seems so simple, yet I can't findthe right methods or syntax to make it work properly.



The following command button code when executed will correctly identifythe total number of checked items but concants the results into the lasthighlighted item's (whether checked or unchecked) recordset. (..like x,x, x, x in one recordset rather than just one x in each recordset of thefour items that were checked). Perhaps it's a simple error on my part,but I just can't see it. Any help to solve this problem would be greatlyappreciated. Thanks.
John

Dim i As Integer



For i = (lstLocations.ListCount - 1) To 0 Step -1
If lstLocations.Selected(i) Then

frmLocationAdd.dataLocation.Recordset.MoveFirst
Do UntilfrmLocationAdd.dataLocation.Recordset.Location ID =lstLocations.ItemData(lstLocations.ListIndex)
frmLocationAdd.dataLocation.Recordset.MoveNext
Loop



frmLocationAdd.dataLocation.Recordset.Edit



If frmLocationAdd.dataLocation.Recordset.RoundsComplet ed= "None" Then
frmLocationAdd.dataLocation.Recordset.RoundsComplet ed = lstRounds & ","
Else:frmLocationAdd.dataLocation.Recordset.RoundsCo mpleted = _frmLocationAdd.dataLocation.Recordset.RoundsComple ted & lstRounds & ", "
End If

frmLocationAdd.dataLocation.UpdateRecord

End If
Next i

RE[1]: SELECTED LISTBOX ITEMS AS WKSHEET NAME
Krishna/All,

Thanks for the insight. My problem now is, how to cycle through the selected items in the listbox on a VB form (not on Excel form).

I realise that it is only the last selected item whose name is used to create just one wksheet.

thx

SELECTED LISTBOX ITEMS AS WKSHEET NAME
Hi All,

I have a listbox styled checkbox with some items e.g..

item1
item2
item3
item4
item5
item6

If a user selects item2, item4 and item6, for e.g., i want excel wksheets be created with these names.

Any code/help would be very much appreciated.

Thx.
DEK

Checking Selected Items Value In A Listbox
Checking selected items value in a listbox ...?

How To Delete Selected Items In Listbox
On the form are:
1 command button named cmdAdd
1 command button named cmdDel (to delete selected items in the listbox)
1 textbox named Text1
1 listbox named List1

here's the code:
Private Sub cmdAdd_Click()
List1.AddItem Text1.Text
Text1.Text = ""
Text1.SetFocus
End Sub

the code works fine. I need a code that would execute the ff:
When I select (or highlight) an item or several items on the listbox and then click the Delete button, that item or items should be deleted from the listbox. Thanks guys!!

[help] Displaying Selected Items In A Listbox
how can I getting Items from my Treeview checkbox when selected to be placed into a Listbox...TIA

Copyright © 2005-08 www.BigResource.com, All rights reserved