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




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




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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 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.

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.

Multiple Items Selected In Listbox Code
I know I've done this before, but I cannot remember the property or method I used to retrieve the selected items from a listbox. Suggestions?

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

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,

How To Send Multiple Selected Items To Clipboard, From A Listbox
Good morning !


I understand how to select one item to the clipboard, but if I want to send multiple items to the clipboard AT THE SAME TIME, I don't understand how to do this.

I'm using a listbox control and need to process the selection of multiple items.

Calling Clipboard.SetText() for each item that is selected in the listbox, will replace the previously selected item that is in the clipboard.

thanks

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.

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

Listview - Multiple Selected Rows Help
Hi, I'm working on a way for a user to group up items in a database. I'm using a listview, but I was wondering if there might be a better way.. I'll probably run into many problems along the way, and here's the first one (besides trying to find a way to get the number of selected items without looping)..

This is what I want to happen..

I populated a listview with the contents of a database, Desc, Asset Number, Quantity.. I want the user to be able to select a groups of rows and combine them into one record in the database.. One thing is that the user can only select items either above or below a currently selected item.. What I tried doing was in the ItemClick event, try to test if the row above or the row below have been selected.. Problem is, when I use the CTRL key to select more than one row, the listview.SelectedItem.Index property is not valid.. How can I find the index of newly select row when other rows have already been selected?
Thanks
John

How To Get The Value Of Multiple Selected Item Using Listview
Im using listview in viewing the list of dates in my database, and i have an option that the user can delete the date what he/she want. I set the listview into multiple select so the user can select how many dates he/she wants to remove in the database. but my problem is i dont know how to get the value of the multi selected item in listview. I know that this is very simple but I dont know how to do it please do help me thanks in advance.

Thanks!!!

Selected Item, Listview And Multiple Selections.
Hi I have a listview that has data loaded onto itself. If a user selects a few items and clicks the ok button I want it to add each selected item into a database. I have this code:

Dim i, j As Integer
Dim strSendTo As String
Dim ShellX As String

strSendTo = ""
LsvEmail.SelectedItem.Text Then
For i = 1 To LsvEmail.ListItems.Count - 1
If LsvEmail.SelectedItem.Text = LsvEmail.ListItems(i).Text Then
strSendTo = strSendTo + LsvEmail.ListItems(i).Text + ";"
End If
Next
If strSendTo = "" Then
MsgBox "Please reselect your Emailing Client as you have not yet selected one."
Exit Sub
End If

strSendTo = Left(strSendTo, Len(strSendTo) - 1)

ShellX = "start mailto:" + strSendTo
Shell ShellX


Now this works to a point. The line :
If LsvEmail.SelectedItem.Text = LsvEmail.ListItems(i).Text Then
is a problem because it just sits at the first selecteditem. How can I move on to the next selecteditem in a listview?

Any help would be appreciated and thanx in advance.

Mike

Add Items To A Listview Multiple Columns
Hi... I have a listview with 3 columns... how can i add items to the second and the third column? i know it's a stupid question but i can't solve it


Thanks in advance

simons

Moving Multiple Listview Items Up Or Down At Once
Hi, does anybody know how to move multiple selected listview items up or down at once?

I found the subs below, but they only move one item up or down, even if I have selected multiple items.

Thanks.


vb Code:
Private Enum menmDirections    MoveUp = 1    MoveDown = 2End Enum Private Sub MoveItem(ByVal penmDirection As menmDirections)Dim lvwItem     As ListItemDim lvwNew      As ListItemDim lvwSubItem  As ListSubItemDim lngIndex    As Long    Set lvwItem = lstView.SelectedItem    If Not (lvwItem Is Nothing) Then        If penmDirection = MoveUp Then            lngIndex = lvwItem.Index + 2        ElseIf penmDirection = MoveDown Then            lngIndex = lvwItem.Index - 1        End If        If lngIndex > 0 And lngIndex <= lstView.ListItems.Count + 1 Then            Set lvwNew = lstView.ListItems.Add(lngIndex, , lvwItem.Text)            For Each lvwSubItem In lvwItem.ListSubItems                lvwNew.ListSubItems.Add , lvwSubItem.Key, lvwSubItem.Text, lvwSubItem.ReportIcon, lvwSubItem.ToolTipText            Next lvwSubItem            lvwNew.Selected = True            Set lvwNew = Nothing            lstView.ListItems.Remove lvwItem.Index        End If        Set lvwItem = Nothing    End IfEnd Sub



vb Code:
Private Sub MoveUp(lv As ListView)    Dim itm As ListItem, itmNew As ListItem, i As Long    If lv.SelectedItem.Index > 1 Then        Set itm = lv.SelectedItem        Set itmNew = lv.ListItems.Add(itm.Index - 1, , itm.Text, itm.Icon, itm.SmallIcon)        For i = 1 To itm.ListSubItems.Count            With itm.ListSubItems(i)                Call itmNew.ListSubItems.Add(, .Key, .Text, .ReportIcon, .ToolTipText)            End With        Next        lv.ListItems.Remove itm.Index        itmNew.Selected = True        lv.SetFocus    End IfEnd Sub Private Sub MoveDown(lv As ListView)    Dim itm As ListItem, itmNew As ListItem, i As Long    If lv.SelectedItem.Index < lv.ListItems.Count Then        Set itm = lv.SelectedItem        Set itmNew = lv.ListItems.Add(itm.Index + 2, , itm.Text, itm.Icon, itm.SmallIcon)        For i = 1 To itm.ListSubItems.Count            With itm.ListSubItems(i)                Call itmNew.ListSubItems.Add(, .Key, .Text, .ReportIcon, .ToolTipText)            End With        Next        lv.ListItems.Remove itm.Index        itmNew.Selected = True        lv.SetFocus    End IfEnd Sub

Listview - DragDrop Multiple Items
I have the following code that successfully will drag & drop one item at a time, but doesn't work all the time if multiple rows are selected?
When I start to drag, sometimes nothing happens.

Anybody point me in the right direction please?


Code:
Private Sub lvwSelected_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
On Error GoTo ErrTrap

Dim i As Long
Dim lvwItem As ListItem

For i = 1 To lvwSource.ListItems.Count
If lvwSource.ListItems(i).Selected = True Then
Set lvwItem = lvwSelected.ListItems.Add(, , lvwSource.ListItems(i).Text)
lvwItem.SubItems(1) = lvwSource.ListItems(i).SubItems(1)
lvwItem.SubItems(2) = lvwSource.ListItems(i).SubItems(2)
'remove original item
lvwSource.ListItems.Remove i
End If
Next

Also, when dragging multiple items across, and removing the original item, I now get an error because the ListItem.Count is now out of bounds.
How would I handle this?
Would I add 1 to the value of 'i' before the next loop?

Dragging Multiple Items From A Listview
i have some code to let users drag an item from a listview onto a treeview node, which works fine, but now i want to let them drag multiple items.

the problem is that when then select a bunch of items, then drag them to the treeview, it leaves only the last item they clicked on selected (as if they selected them, then just left-clicked one of them). is there a way to keep them all selected?

also, just out of interest, is there a way to make the drag icon include some text from each selected listview item along with an icon (like when you drag multiple files in windows explorer)?

thanks for any help

Remove Multiple Items From ListView
I've got a ListView control with the MultiSelect property set to True and would like to remove all of the selected items only. I've looked at some of the threads concerning this issue but am still having trouble. I can remove a single selected item but not all of the selected items. My code is as follows:


Code:
Private Sub cmdRemove_Click()

Dim I As Integer

For I = 1 To lstPlot.ListItems.Count
If lstPlot.ListItems(I).Selected = True Then
lstPlot.ListItems.Remove (I)
End If
Next I

End Sub


What am I missing?

Thanks for your help!

Multiple Select Items In Listview
im having a problem in listview. ther ar 2 listviews for Excel and server. the user will select fields in th excel lisview he want to upload in server lisview. it upload a field if the user only select 1 field. but if it highlights many fields it only copy the lastselected fields the other fields highlighted dont work. heres my code:

j = LVExcel.ListItems.Count
 For i = j To 1 Step -1
  If LVExcel.ListItems(i).Selected = True And LVDatabase.ListItems(i).Selected = True Then
        Set rs1 = New ADODB.Recordset
        destinationtble = "select * from [user]"
        rs1.Open destinationtble, gcn, adOpenKeyset, adLockOptimistic
           Do While Not RS.EOF
              rs1.AddNew
              rs1.Fields(LVDatabase.SelectedItem.Text) = RS.Fields(LVExcel.SelectedItem.Text)
              rs1.Update
              RS.MoveNext
           Loop
          Set RS = Nothing
  End If
next i

Please Help Me With Drag-n-Drop Of Multiple Items From One Listview To Another.
Hello!

I'm facing a problem with Listview Drog and Drop of multiple items from one listview to another listview. When I try to Drag only one single item, the item is dragged without any problem. However, when the multiple selected items are dragged, the Listview on which the items are dropped, receives information about only one item and not all selected items. The item, about which the information is received, is the same on which I click and hold mouse to start drag action. So, it looks like even though multiple items are selected in a listview, while executing the Drag-Drop action, listview treats it as single item selected!

Is this a default behavior of Listview or am I missing/doing anything wrong? Any work-around for this (seems like default) behavior of Listview? I searched for it and got a code example at http://btmtz.mvps.org/listview/ where the author has demonstrated Drag-Drop of multiple items. However, the code is specifically restricted to re-arranging items within same Listview and the information is transported via Drag-Drop to another Listview, upon which the items are dropped.

To help you all to get a better insight of my problem, I have attached a Demo of Listview Drag-n-Drop. Please see the project and you will see that when one item is dragged from left side Listview to right side Listview, no problem for VB to allow me to do it! However, when you select multiple items in left side Listview and try dragging those to right side Listview, only one item is dragged. Please let me know if I'm doing anything wrong here and please help me to get this stuff to work!

Waiting for your valuable reply ...

Regards,

Ruturaj.

Drag Multiple Items From Listview To Treeview
Does anyone have some good sample code for how to
drag multiple listviewitems to an treeview?!

I cant figure it out...

Regards

Peter

Show Multiple Items In Listview Taken From Database
How would I show multiple items from an Access database in a listview?

Example: Let's say my database looks like this:

Sender Subject Date
me@isp.com Some Subject 1-13-00 7:59AM
you@otherisp.com Some other subject 7-30-01 8:00AM

I want to load both items into a listview. My current procedure only loads one item at a time. Here is the procedure:


Code:
Dim Recordset As ADODB.Recordset
Select Case Node.Text
Case "Trash"
If Recordset.EOF = True Then Exit Sub
lvwMail.ListItems.Clear
With lvwMail.ListItems.Add(, , Recordset!Sender)
.SubItems(1) = Recordset!Subject
.SubItems(2) = Recordset!Date
End With
End Select

Please Help Me With Drag-n-Drop Of Multiple Items From One Listview To Another.
Hello!

I'm facing a problem with Listview Drog and Drop of multiple items from one listview to another listview. When I try to Drag only one single item, the item is dragged without any problem. However, when the multiple selected items are dragged, the Listview on which the items are dropped, receives information about only one item and not all selected items. The item, about which the information is received, is the same on which I click and hold mouse to start drag action. So, it looks like even though multiple items are selected in a listview, while executing the Drag-Drop action, listview treats it as single item selected!

Is this a default behavior of Listview or am I missing/doing anything wrong? Any work-around for this (seems like default) behavior of Listview? I searched for it and got a code example at http://btmtz.mvps.org/listview/ where the author has demonstrated Drag-Drop of multiple items. However, the code is specifically restricted to re-arranging items within same Listview and the information is transported via Drag-Drop to another Listview, upon which the items are dropped.

To help you all to get a better insight of my problem, I have attached a Demo of Listview Drag-n-Drop. Please see the project and you will see that when one item is dragged from left side Listview to right side Listview, no problem for VB to allow me to do it! However, when you select multiple items in left side Listview and try dragging those to right side Listview, only one item is dragged. Please let me know if I'm doing anything wrong here and please help me to get this stuff to work!

Waiting for your valuable reply ...

Regards,

Ruturaj.

Please Help Me With Drag-n-Drop Of Multiple Items From One Listview To Another.
Hello!

I'm facing a problem with Listview Drog and Drop of multiple items from one listview to another listview. When I try to Drag only one single item, the item is dragged without any problem. However, when the multiple selected items are dragged, the Listview on which the items are dropped, receives information about only one item and not all selected items. The item, about which the information is received, is the same on which I click and hold mouse to start drag action. So, it looks like even though multiple items are selected in a listview, while executing the Drag-Drop action, listview treats it as single item selected!

Is this a default behavior of Listview or am I missing/doing anything wrong? Any work-around for this (seems like default) behavior of Listview? I searched for it and got a code example at http://btmtz.mvps.org/listview/ where the author has demonstrated Drag-Drop of multiple items. However, the code is specifically restricted to re-arranging items within same Listview and the information is transported via Drag-Drop to another Listview, upon which the items are dropped.

To help you all to get a better insight of my problem, I have attached a Demo of Listview Drag-n-Drop. Please see the project and you will see that when one item is dragged from left side Listview to right side Listview, no problem for VB to allow me to do it! However, when you select multiple items in left side Listview and try dragging those to right side Listview, only one item is dragged. Please let me know if I'm doing anything wrong here and please help me to get this stuff to work!

Waiting for your valuable reply ...

Regards,

Ruturaj.

Please Help Me With Drag-n-Drop Of Multiple Items From One Listview To Another.
Hello!

I'm facing a problem with Listview Drog and Drop of multiple items from one listview to another listview. When I try to Drag only one single item, the item is dragged without any problem. However, when the multiple selected items are dragged, the Listview on which the items are dropped, receives information about only one item and not all selected items. The item, about which the information is received, is the same on which I click and hold mouse to start drag action. So, it looks like even though multiple items are selected in a listview, while executing the Drag-Drop action, listview treats it as single item selected!

Is this a default behavior of Listview or am I missing/doing anything wrong? Any work-around for this (seems like default) behavior of Listview? I searched for it and got a code example at http://btmtz.mvps.org/listview/ where the author has demonstrated Drag-Drop of multiple items. However, the code is specifically restricted to re-arranging items within same Listview and the information is transported via Drag-Drop to another Listview, upon which the items are dropped.

To help you all to get a better insight of my problem, I have attached a Demo of Listview Drag-n-Drop. Please see the project and you will see that when one item is dragged from left side Listview to right side Listview, no problem for VB to allow me to do it! However, when you select multiple items in left side Listview and try dragging those to right side Listview, only one item is dragged. Please let me know if I'm doing anything wrong here and please help me to get this stuff to work!

Waiting for your valuable reply ...

Regards,

Ruturaj.

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

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