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




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?




View Complete Forum Thread with Replies

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

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 Move Selected Item Up Or Down
hi ,...

i would like to know how can i move a selected item in the listview up or down ?!

i tried :


Code:
listview1.selecteditem.index=listview1.selecteditem.index-1
or
listview1.selecteditem.index =listview1.selecteditem.index +1

but this is not working !!
anyone can help me please !?

thanks in advance ..

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.

Move Items In The Listview
I am refer the following thread below to move the items in the listview.

http://www.vbforums.com/showthread.p...items+listview

When there is not items in the listview, I click the button, I got the error message. and the error message point at
strCol1 = ListView1.SelectedItem

So How to solve it?


Code:
Dim itmX As ListItem
Dim strCol1 As String
Dim strCol2 As String
Dim lngIndex As Long
strCol1 = ListView1.SelectedItem
strCol2 = ListView1.SelectedItem.SubItems(1)
lngIndex = ListView1.SelectedItem.Index
ListView1.ListItems.Remove (lngIndex)
If lngIndex = ListView1.ListItems.Count + 1 Then
lngIndex = 0
End If
Set itmX = ListView1.ListItems.Add(lngIndex + 1, , strCol1)
itmX.SubItems(1) = strCol2

ListView1.ListItems(lngIndex + 1).selected = True

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,

Move Record From Selected Listview Checkbox To Another Table
hello,please help how to move database record from selected listview checkbox to another table.For example:Have 2 table name temp and overtime.
the data display at listview is from temp table by using selected checkbox move to Overtime table.

below is the data display at listview from temp table:

Code:
Dim rs As ADODB.Recordset
Dim conDataConnection As Connection
Dim list_item As ListItem

Set conDataConnection = New Connection
conDataConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & _
"Overtime.mdb;Persist Security Info=False"

Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM Temp", conDataConnection, adOpenStatic, adLockOptimistic

' Load the data.
Do While Not rs.EOF
Set list_item = ListView1.ListItems.Add()
list_item.SubItems(1) = rs!EmployeeName.Value & ""
list_item.SubItems(2) = rs!EmployeeNo.Value & ""
list_item.SubItems(3) = rs!Designation.Value & ""
list_item.SubItems(4) = rs!Department.Value & ""
list_item.SubItems(5) = rs!Shift.Value & "" 'method of invalid use of null .Value & ""
list_item.SubItems(6) = rs!OvertimeDate.Value & ""
list_item.SubItems(7) = rs!TimeFrom.Value & ""
list_item.SubItems(8) = rs!TimeTo.Value & ""
list_item.SubItems(9) = rs!Breaktime.Value & ""
list_item.SubItems(10) = rs!OtRate.Value & ""
list_item.SubItems(11) = rs!CategoryDay.Value & ""
list_item.SubItems(12) = rs!WorkDescript.Value & ""

rs.MoveNext
Loop

rs.Close


thanks for help!

Move Record From Selected Listview Checkbox To Another Table
hello,please help how to move database record from selected listview checkbox to another table.For example:Have 2 table name temp and overtime.
the data display at listview is from temp table by using selected checkbox move to Overtime table.

below is the data display at listview from temp table:
Code:Dim rs As ADODB.Recordset
  Dim conDataConnection As Connection
  Dim list_item As ListItem

      Set conDataConnection = New Connection
      conDataConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & _
                "Overtime.mdb;Persist Security Info=False"
   
      Set rs = New ADODB.Recordset
     rs.Open "SELECT * FROM Temp", conDataConnection, adOpenStatic, adLockOptimistic
      
      ' Load the data.
    Do While Not rs.EOF
        Set list_item = ListView1.ListItems.Add()
        list_item.SubItems(1) = rs!EmployeeName.Value & ""
        list_item.SubItems(2) = rs!EmployeeNo.Value & ""
        list_item.SubItems(3) = rs!Designation.Value & ""
        list_item.SubItems(4) = rs!Department.Value & ""
        list_item.SubItems(5) = rs!Shift.Value & "" 'method of invalid use of null .Value & ""
        list_item.SubItems(6) = rs!OvertimeDate.Value & ""
        list_item.SubItems(7) = rs!TimeFrom.Value & ""
        list_item.SubItems(8) = rs!TimeTo.Value & ""
        list_item.SubItems(9) = rs!Breaktime.Value & ""
        list_item.SubItems(10) = rs!OtRate.Value & ""
        list_item.SubItems(11) = rs!CategoryDay.Value & ""
        list_item.SubItems(12) = rs!WorkDescript.Value & ""
              
        rs.MoveNext
    Loop
      
     rs.Close

Thanks for help!

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

Move Listview Items Up/down **RESOLVED**
I'm brand new to the listview and I can't seem to figure this out. I searched the forum and didn't see anything, so...
How do you set the index of an item in the listview? For example, a button the moves the selected item down one position.

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.

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

Drag/Move Items In Listview Like In WinAmp
Hi,

How to make dragable/moveable items in Listview like in WinAmp?
I use viev mode: report (3)
My list have 10 collumns.

The example how to do it would be great ;]

Thanks

Move Items In Listview - Including Subitems
I needed to know how to move items in a listbox up and down. I searched on here and found the code below (Thanks!) but when I use it and move an item, it looses the subitems with it. It only moves the first column. Can someone show me what to do to move the remaining 3 columns each time? And also, what error trap can I put to prevent an error if no items are available to move or if the item it at the top already and I try to move it up?

Thanks alot!!!!

Private Sub ListView1_KeyDown(KeyCode As Integer, Shift As Integer)
x = ListView1.SelectedItem.Index
With ListView1.ListItems
Select Case KeyCode
Case vbKeyUp
.Add x - 1, , .Item(x)
.Remove x + 1
Set ListView1.SelectedItem = .Item(x)
Case vbKeyDown
.Add x + 2, , .Item(x)
.Remove x
Set ListView1.SelectedItem = .Item(x)
End Select
End With
End Sub

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.

###MoVe Items In A ListBOX! Simple Help! Like I Want To Move An Item One Down ###
Hi every1,

ANy1 knws any quick way by which i can move items in a listbox?
Like i have a list box and when i click a button i want the time to be move down by one item in the list or move up by one item...

cud any1 suggest a good method?


thx

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?

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