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

ListView Multi-select

When you turn the MultiSelect property for a ListView control on, how do you determine if more than one item was selected?



View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Multi Select In ListView
when I want to choose more than one line together in list view I can drag the mouse over all the lines that i want to choose.....but... the problem is that i can drag it just when i start the drag from the frist column in the list view from all the other columns dragging the mouse doesnt make the lines to be selected. so, is there a way that i could drag also from other columns in the list view and it will select the lines?

Listview Multi Select
How would I go about making the list view multiselect when I click and drag on it rather than useing crtl/Shift + click/up/down ?

ListView - Multi File Select
Hey guys,

When I use the ListView control in my program I am able to highlight with the mouse multiple files and folders with a simple drag to select them. One problem I can't seem to get around is that when the listview loads files, the first item is always selected. If I select multiple files, the first file is always included with the selected bunch.

Is there a way to remove that file from the selected list?


Is there a way to know what files have been chosen during the multiple select? I tried the HitTest(x.y) but not always over a file when it gets selected, strange.

Your help is much appreciated.

ListView Multi-select Question
How do you properly and effeciently handle a multiple selection in the ListView?

For example, I need to accomplish the following:

If the user makes a multiple selection, I need to somehow store in code which items the user selected and then do some other processing with those selected items..

Does that make sense? In other words, say there are 6 items in ListView1. Item1,Item2,Item3, etc...

The user selects Item1, Item4, Item5, Item6. I need to beable to store each one in memory so that when the next sub is called, the sub is passed those items so it can do some processing based on the selected items...

Also, I need to do the same with a range selection.. So that if the user clicks on Item1 and holds the shift key down and clicks on Item4, I need to beable to store any items that falls between Item1 and Item 4.

Thanks and any help would be appreciated..


Want To Disable Select In Multi-select Listbox
Hi everybody,
I am using a multi-select list box with check boxes in an entry module. I am using the list box to enter as well as display data. While entering data I want the full functionality of the list box. But while displaying data, I want to avoid the user from selecting or checking any item in the list box. However, the user should be able to scroll to view all items in the list box. Setting the Enabled property to False disables everything including the scrollbar. Is that possible?

Multi Select
I have a listbox with its MultiSelect property set to 2 - Extended. When i select several items in the listbox at runtime and click my remove button, it only removes the item with the dotted outline.
Any ideas how i can remove all the selected items? -Thanks

Given the pic below how can I, in ONE select statement, grab this data by year to date, month to date etc..?

Multi Select
how would you get the information for all of the selected items in a filelist box

for example
the user selects three items and you need to add all of their names them to a list box

What property do you set to allow a treeview control to allow for multi-selctions at one time?



Given the pic below how can I, in ONE select statement, grab this data by year to date, month to date etc..?
I want it to look like this:

In the Query Analyzer I get this:

Multi Select
how can i select more then 1 file with the common dialog? (Multi select)

Multi-select In Msflexgrid
I need to do multiSelection in a msflexgrid (with the mouse) and i can't figure how to get wich cells are selected. Does anybody has an idea ??

Multi Select List Box

I have a multi select list box. On my UserForm_Initialize I have

UserForm1.ListBox1.AddItem "a"
UserForm1.ListBox1.AddItem "b"
UserForm1.ListBox1.AddItem "c"
UserForm1.ListBox1.AddItem "d"
UserForm1.ListBox1.AddItem "e"

On my comand button I want to return the values in the list box and place them into an array.

Any ideas?

Multi Select In Listbox
I would like to initialize a Listbox control so that when it first comes up, multiple cells are selected. If I do something like the following, what I get is one highlighted cell, and one in the state a highlighted cell appears in when the cell is selected but the window is deactivated.

With myListBox
.MultiSelect = fmMultiSelectExtended
.Selected(1) = True
.Selected(2) = True
End With

This probably sounds a bit strange but, what I am really trying to do is make the Listbox behave such that clicking in a cell forces 3 entries to be selected. Clicking in cell 0 forces cells 0, 1, and 2 to be selected. Clicking in cell 3 forces 3, 4, and 5 to be selected.

Any ideas would be greatly appreciated.

Multi Select Techboxes
I have a problem when you use this, If you say select ancient scry stones then anagronomy is multiplies the values of it twice but when you go from anagronomy to ancient scry stones it adds how it should anyone know why here is my code.

Private Sub Command1_Click()
'Allows Simple MultiSelect
Dim i As Integer
If List5.ListIndex = -1 Then Exit Sub
For i = List5.ListCount - 1 To 0 Step -1
If List5.Selected(i) = True Then
'Adds Permanents
If List5.Text = "Anagronomy" Then
Text4(0).Text = Text4(0).Text + 100 'agr
Text4(3).Text = Text4(3).Text + 100 'f agr
End If
If list5.Text = "Ancient Scry Stones" Then
Text8(0).Text = Text8(0).Text + 120 'Ecco
Text8(3).Text = Text8(3).Text + 120 'f Ecco
Text13(0).Text = Text13(0).Text + 200 'Intell
Text13(3).Text = Text13(3).Text + 200 'f Intell
End If
List7.AddItem List5.List(i)
List5.RemoveItem i
End If
Next i
end with
End Sub

Multi Select List Box
I have a List Box on an Excel worksheet, which I need to have set as a Multi or Extend select.

I need to be able to access which selections are made, and was pointed to this :

Sub showSelected()
Dim i As Integer

With ActiveSheet.yourListBox
For i = LBound(.List) To UBound(.List)
If .Selected(i) = True Then
MsgBox .List(i)
End If
Next i
End With
End Sub
But that doesn't work.

Any ideas on what to do?

Multi Case Select
Hey gang, need some help here with my case select approach.
Basically, 2 conditions need to be met before the function returns the correct strYCoord.

When I execute this it always returns strYCoord = 2000.25. Can someone shed some light on my "rookieness"?

Hope I've provided enough info.

Thanks in advance.
Private Function Get_Y_Coordinate(ByVal strYCoord) As String
Dim mBox As String
Dim aBox As String

mBox = grpBoxMod.TabIndex
aBox = grpBox.TabIndex

Select Case grpBoxMod.TabIndex = mBox And grpBox.TabIndex = aBox
Case grpBoxMod.TabIndex = 0, 1, 6 And grpBox.TabIndex = 0
strYCoord = 2000.25
Case grpBoxMod.TabIndex = 0, 1, 6 And grpBox.TabIndex = 1
strYCoord = 1700.75
Case grpBoxMod.TabIndex = 2 To 3 And grpBox.TabIndex = 0
strYCoord = 1500.5
Case grpBoxMod.TabIndex = 2 To 3 And grpBox.TabIndex = 1
strYCoord = 1400.0
Case grpBoxMod.TabIndex = 4 To 5 And grpBox.TabIndex = 0
strYCoord = 1300.75
Case grpBoxMod.TabIndex = 4 To 5 And grpBox.TabIndex = 1
strYCoord = 1200.75
Case Else
Debug.WriteLine("Not Valid")
End Select
Return strYCoord
End Function

Multi Select List Box
Hi everyone ...
I am trying to capture the Index# and the text of each item selected in a multi select listbox.
I thought this would work, but it stays on the last item only.

Dim i As Integer
MsgBox List1.SelCount
For i = 0 To List1.ListCount - 1
If List1.Selected(i) = True Then
MsgBox "item sel." & List1.ListIndex & " " & List1.Text
End If
Next i
Obviously this only for testing before I use it the real way.
Any help

Listbox Multi-Select
I want to write all of the items in a listbox that are selected to an array. What is the quick way to identify which item(s) are selected?


Multi Select Vsflexgrid
I can select a group of rows on my vsflexgrid that are next to each other by holding the shift button, but tried holding the control button and selecting multiple rows in my flexgrid that are not side by side without any luck. Wondering how this is done or if there is an example somewhere.

List Box Multi-Select
Hi all,

Sorry if this is a simple question, but I can't seem to get it to work. What I have are two list boxes. One has available information and the other is for selected information. The user selects items from the available list and adds them (with a button) to the selected list and vice-versa. I have the boxes set up to allow multi select, and it will select just fine. The problem, however, is in the adding/removing. When the button is clicked, instead of moving ALL selected items over, it moves just one. Here's the code I'm using:

Private Sub cmdAdd_Click()
Dim strCache As String

On Error GoTo err_add
strCache = lstAvail.Text
lstAvail.RemoveItem (lstAvail.ListIndex)
lstSelected.AddItem (strCache)
lblAvail.Caption = "Total Available: " & lstAvail.ListCount
lblSelected.Caption = "Total Selected: " & lstSelected.ListCount

Exit Sub

Select Case Err.Number
Case 5
MsgBox "You cannot add a blank queue" & vbCrLf & "Please Select A Queue", vbExclamation, "Select A Queue"
End Select
End Sub
I thought I would need a loop of some sort, but everything I tried didn't work. I'm stumped.

Multi Select Records
I have a set of records displayed in a Datagrid Control. Is it possible to select (For eg.)records 1,2,3 and 8 out of 10 records and set the name field to the same name?

Multi-select Tool
I am writing a little order management prog for my friend and i need to be able to multiselect each item i wish to set "As ordered" and also assign the Order No. to each item. Im fairly new to this so do you please have any suggestions as to the best tool to use? ( I am currently using a datagrid to display all the items and thier details...this doesnt seem to allow me to select multiple records.)

Best Multi Select Method

I have a recordset that contains a field that is a yes no field

I need to present my users will all the records and allow them to select all the records they want to be yes or no.

Something similar to the multi select method of a list box would be ideal where when my form is opened all the records with the yes/no field set to yes have the checkbox checked and when my user presses a button the records are updated to yes or no depending on if they are selected or not

Can anyone point me in the right direction (or tell me the control that would be best suited to this task) to get me started please

Thanks for looking


Listbox Multi Select Please Help :(
I am using vb6 and access.
I have a multi select list box I am using to create a dynamic report.
Here is my code:

Private Sub cmdView_Click()
If optName.Value = True Then
'lstProcess = Listbox
'qryProcess = query created by the code

Dim Q As QueryDef, DB As Database
Dim Criteria As String
Dim ctl As Control
Dim Itm As Variant

' Build a list of the selections.
Set ctl = Me![List1]

For Each Itm In ctl.ItemsSelected
If Len(Criteria) = 0 Then
Criteria = Chr(34) & ctl.ItemData(Itm) & Chr(34)
Criteria = Criteria & "," & Chr(34) & ctl.ItemData(Itm) _
& Chr(34)
End If
Next Itm

If Len(Criteria) = 0 Then
Itm = MsgBox("You must select one or more items in the" & _
" list box!", 0, "No Selection Made")
Exit Sub
End If

I am getting an error with ItemsSelected.
It is error 438 object doesnt support object or method. Suspect I am missing a reference or component based on google search? I am using a learning edition of vb I got from a textbook?

I am struggling so hard with this project and I have to have it to graduate from college...
yuk and booohoo.

How Can I Multi-select With DialogBox?
Hi, I had a question yesterday about getting the dialog box to choose and save a file. And it works great.

But my question is, how can I get it to multi-select items?

I'm using this code:


Originally Posted by Code

Dim FileName As String
CommonDialog1.Filter = "Filtered extensions here"
FileName = CommonDialog1.FileName
If FileName <> vbNullString Then
Open FileName For OutPut as #1
End If

How would I change this?

I thought changing: OutPut as #1 to #2 or 3 would work, but I was wrong.

Any thoughts?

Multi Select In Treeview
hello all,
do anyone know how to make multi select treeviews? Any help... pls. Google did'nt help me much.


Multi-select Listbox Help
I have 2 listboxes and a button. List1 is multi-select enabled and when you press the button, it should take the selected items in List1 and put them in List2. However, I can not seem to find a simple way of doing this. Can someone tell me if there is a quick and easy way to do this? Thanks.

Multi Select In TreeView

I'm new to VB and was wondering if the TreeView supports multi-selection. I would like to present items in a treeview format and let the user select multi-items and then loop through the ones selected.


Multi Select Folders
I want to display a directory structure like in a dirlistbox and allow the user to select multiple folders.

then when a button is clicked the program would iterate through the selected folders and for each folder pull all the files contained in the folder into one big list.

can i do this with a dirlistbox or would a treeview be better?

Select Multi Files
i read using common dialog control
we can select more than one file...
how can that be done...
any tips


Multi Select In Listbox
How do I detect multiple selections in a listbox so that I can shift them to another list box?

Multi Select Listbox
I am new to using forms and need some help.

i have two list boxes. the second of which is a multi select listbox. i wish to add the selected items to the first listbox whilst removing them from the second list box.

A simple task I know but I just dont know where to start.

Multi-Select Combo Box
Is there a way to configure the standard VB combo box to handle multiple selection?


Select Multi Into Listbox
Can ne1 show me how can i select multi files in a common dialog, and then add them to a listbox 1 by 1?
also i need to know the path of each added file so i can open em later via the listbox (i'm using another listbox to add the files paths..u know a better way?)

Multi Select From Listbox
i was wondering if someone can tell me how to use the multi select in the listbox.
what i really require is i have alistbox which displays the fields in a database table.
i want the user to click on the feilds they require to fill in and then bring up form with the same number of feilds.
what i require in the firstly is how to tell which items are selected from the list box.

DataList Multi-select
just discovered much to my dismay that the DataList does not have a MultiSelect property. I need to have the list directly connected to the database, so I can't very well use the old ListBox control since I am using ADO and would have to populate it on the fly.

can multi-select be done with a datalist? If so, how?

Multi Select Combo Box
Hi all, is there a way to make a combo box multiselect. That way the user could choose more then one value to be populated in the database. This is for an access db but it can also be applied to a vb front end.


How Can I Use Multi Select In TreeView
Hi, Gurus

I have a treeview in a form, I want to select multi items and then drag them
to a grid.
Right now I can only select one by one.



How Do I Multi Select In A Grid
List box is not an option as I need the data formating that I get from a grid control. Please Help. Thanx.

Multi Select Listbox
Wow, this is driving me crazy.

Just started with Visual Basic Express 2008, after coming from an Access and VBA background.

All I am trying to do is loop through a multi-select listbox and retrieve all the selected items, but it doesnt want to play nice.

What I have tried:

            For Each varItem In Me.ListBox1.SelectedItems


            Next varItem

And I get the error message: Conversion from type 'DataRowView' to type 'Integer' is not valid.

The listbox is a single column bound item with string fields.

What am I missing?

Multi Select Combo
Dear friends,

I am having Problem, i ha a very little space on my form so that i canot display a multi select list box, so i neea acombo box where i can select multiple items in it.

hope someone help,


Multi Select Listbox
hi forum

does anyone knows how to select all the items in a list box?

i'v set the listbox multi select property to 1.. but it seems my code hangs up when i use my code

Dim x As Integer
x = 0
Do Until x >= List2.ListCount - 1
List2.Selected(x) = True

pls help


oops! i think i made a mistake... sory forum, i placed my post on the wrong corner.. how do i transfer this post to vbnewbies?

Edited by - lynger on 6/9/2004 11:52:15 PM

Multi-Select Combobox

I want to know whether there is someway i can make a combo box multi-select OR is there any other control which has an interface like a combo but allows the user to select multiple fields

I am using VBA and so far i have not found anything. I will be grateful for any help.


TreeView - Multi-select
How can i do Multi-selection in a TreeView?
Thanks in advance

Multi Select Combo Box
Hello everyone
I was just wondering if there is a way I can support multi-select combo box. As far I have researched there seems to be no way doing it even using subclassing. I am not sure if there is a way still?
But could someone suggest me a nice alternative control other than the List box because the client seems to be comfortable with the idea of drop down list but would like to use multi-selection. Thanks for any forthcoming help

Browse For Folder: Multi-Select

Is it possible to select multiple folders using the Browse For Folder dialog by supplying some special flags?

Sebastian Mares

Multi Select (listbox) And Fillter Though.
Hi All,

If you have a look at the project attached you will some names in the lisdt box, if you clcik on one of the names then click the open button to read in a word doc once done this press print, the outcome will be the name that you clcik on at the start will show up in the printout, all this is good so far, but my problem is I dont know how I can have it so that if I click multible names then open the test letter doc and press print to loop though each name and change the names for each diffrent letter. ie, if I selected Amy mason, Ben Riches and Terry Riches I then read in my doc then press the print button the outcome then should be the same letter printed 3 times but on the first letter it should have the name Amy mason, the second Ben Riches and the Third Tery riches.

Could someone please help me with this,

Kind Regards


Multi Select Objects In A Frame
Stupid question...

Is there a quick way to multi select objects in a Frame? I know you can box select multiple objects on a form so you can Align them and such. But you can't seem to do it inside a frame. Every time I try I end up moving the frame. I have to Shift-Click each object that I want selected to get a group.


Copyright 2005-08, All rights reserved