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

VB6 Listview Selected


I have in VB6 created a listview

The listview has 3 colums.

Now i can select a row in the listview with the mouse pointer.

The thing that i would do now is to push on a button and then a message box appears with the text that is selected in the listview ,but only the second row must be displayed in the msgbox.

ex :
1 beaf 22$
1 meat 10$
1 burger 5$

so if a select row 2 ,the msg box must display : meat

Who can help me with that ?

Thanks a lot

View Complete Forum Thread with Replies

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

Listview Selected
Listview selected

ListView1.View = lvwReport
(A) (B) (C) (D) (E)...
(1) A1 B1 C1 D1 E1
(2) A2 B2 C2 D2 E2
(3) A3 B3 C3 D3 E3
(4) A4 B4 C4 D4 E4
(5) A5 B5 C5 D5 E5

Use ListView (Report Mode), Only use Mouse touch (A1) and auto Selected (A1), my problem is...

(1) how to if touch A1, will auto that B1,C1,D1,E1....Selected?

(2) how to free click? mean click which line and which colum(B,C,D,E...), auto selected!
example: Use Mouse touch C3, will auto C1,C2,C3,C4,C5 auto selected !

can suggest me! many thanks!

Listview Selected
I want to get the indexnumber from a listview of the seleted item (single selected)

(i can get the numbers of selected items "t = ListView1.SelectedItems.Count")

Are there any solutions.

I am new in visual basic.

best regards

Listview Nothing Selected
I have a list view where I want to catch for nothing selected. How do i say ' if listview.selecteditem = Nothing then ' if nothing is selected it shows ' listview.selecteditem = Nothing ' but I cannot catch nothing because it is that the object is not set. I believe?

How To Set The Selected Row In A Listview
I have a listview where I need to be able to set the selected row to the last row selected by the user. My form allows the user to select a value from the listview and another grid loads data based on whats selected in the listview. But when the user saves and the listview reloads and it displays as it does the first time it was loaded. This is where I'd like to set the selected row to the last row the user selected. Is this possible? If so how?

How To Get Selected Value From Listview
My project is based upon a drugs dispensing unit.

My listview is in a report form. My user will click on the name of the person, and it will select the PatientID.

How would I get the value of the selected value, because I need to have it sent to a subroutine, where the value of that will execute another set of code.

thanks, kregg

ListView If Selected
Hi, im having problem with listview if selected line and appear to textbox


i have 5 lines in ListView


Name | Number

John 12345
Jean 55555
Tom 99999
Hanna 88888
Bob 77777

if i select i one of them example Tom the number should appear on text1.text
i tried it but i get an error.

Listview Selected
i have a listview filled with 100 records,

when my user search a record appears at the bottom, so i move the selected record to it lvwmain.listitem(i).selected = true.

but the problem is, listview just selected it, but didn't move down the page.
i can do it by mshflexgrid by using toprow
i totally no idea bout list view

anyone can help me?

Listview Selected

I have a routine in witch i get data out of a listview, dragging it to a textbox. The problem is that as soon i drop the data, automaticly the next first item in the listview is selected.
How to prevent that there is a new item is selected in the listview, (index - 1 don't seems to work) until i click the next item
Can someone give me a helping hand

Is The Listview Selected?
to do this for a listbox i do

VB Code:
if listbox1.listindex > -1 thenlistboxselected = trueend if

there is no listindex value for a listview so how can i tell if a item is selected?

i tried selecteditem but i get an error if no item is selected (object is not set).

Is Any Row Selected In The Listview?

How do I know if any row is selected in a listview?


Listview Selected
Help!! I have a listview with multiline property set, I have to select from the listview more than 1 item and passed them to a combo, unfortunatly the listview holds only the latest item and I don't know how to keep the other.
here is a part of the code, when I click the item:

If ListView1.ListItems.Count > 0 And ListView1.SelectedItem.Index > -1 Then
    For Each itMX In ListView1.ListItems
        If itMX.Selected = True Then
           itMX.Checked = True
           NewStruct(selCount).Codice = itMX.Text
              selCount = selCount + 1
        End If
End If


ListView: Selected Row
I have a row selected in my listview. How can I reference the items in the selected row so that I may populate another form with those values? Basically I'm trying to select a row for editing, and when they click on the Edit button display another form with the selected record displayed. I'm guessing I can just populate the fields on the 2nd form with 'formname.txtbox.text' or something similar? Any suggestions would be great!!


Listview Get Currently Selected Item
Is there a way to get the currently selecteditems text for a listview. I'm using vb 2005 and I don't see how to get a listview currently selecteditem. Someone please help me

Thanks for any help
Chris Ara

Listview Selected Item
How can i get the selected item of a listview in another form ???

I have tried with this code:

Public Function geselecteerdLid() As Integer
Dim iLidID As Integer
Dim oItem As ListViewItem
For Each oItem In lvwLeden.SelectedItems
iLidID = Convert.ToInt32(oItem.Text)
Return iLidID
End Function
and in another form i refer to this with

Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
Dim oForm As New frmLid
End Sub
the result of this is always 0, i guess this is because i make an object of the form where my listview is (frmLid)

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 ...

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 ?



How To Get Listview Selected Item?
Private Sub Form_Load()
With lvwSpecies
' Add three columns to the list - one for each data type.
' Note that the data type is set in the column header's
' tag in each case

.ColumnHeaders.Add(, , strHeader(0)).Tag = "STRING"
.ColumnHeaders.Add(, , strHeader(1)).Tag = "STRING"
.ColumnHeaders.Add(, , strHeader(2)).Tag = "String"
' Set the column alignment - has no bearing on the sorts.

.ColumnHeaders(1).Alignment = lvwColumnLeft
.ColumnHeaders(2).Alignment = lvwColumnCenter
.ColumnHeaders(3).Alignment = lvwColumnCenter

.ColumnHeaders(2).Width = 3000
'Populate the list with data in Species files
Dim intCounter As Integer
With .ListItems
For intCounter = LBound(codeTypeArray) To UBound(codeTypeArray)
With .Add(, , codeTypeArray(intCounter).strCode)
.ListSubItems.Add , , codeTypeArray(intCounter).strCodeInfo
.ListSubItems.Add , , str(codeTypeArray(intCounter).intMaxNumber)
End With
End With
End With

End Sub

Private Sub ok_Click()
Dim str As String
str = lvwSpecies.text

'what should go here if i want to get the text of select item? i just
'need the text of first colum.

End Sub
Is there a way to get the item text?

Listview - Selected Item
Dear All,

I have an access DB connected to a Treeview and a listview.

Navigation is done by ADO unbound.

How do I connect the highlighted item in the listview with a particular database recordset?

Say for example:

I click on the Next_Record button I would like the Cursor (Highlighted blue area) to move to the next record displayed in the listview corresponding to the correct database record.

Prev_Record button will move the blue highlighted area one position up in the listview and so forth...

Any ideas?


GetItem Selected In ListView
Please, somebody can help ?????

I have a listview and I have can configure sort date column by the API. But I need get the item selected by API, the only I can do is return the text of the item selected but I need the item complete ... HOW CAN I DO IT ??? ...

here teh code to get the string of the item selected:

Private Function GetTextSelected(index As Integer)
Dim hIndex As Long
Dim hItem As Long
Dim sItem As String
Dim r As Long

With objItem
.mask = LVIF_TEXT
.iSubItem = 1
.pszText = Space$(32)
.cchTextMax = Len(.pszText)
End With

r = MListView.SendMessage(ListView.hWnd, LVM_GETITEMTEXT, index, objItem)
sItem = Left$(objItem.pszText, r)

GetTextSelected = sItem

End Function

Thanks for help me!!!!

Listview Selected Listitem
have problem here, I have selected listitem in my listview and then I check the check the checkbox to true to update the record only this item, then the selected item in my listview is set clear.why? I want to the selected listitem retain the selected item in the listview when I check the checkbox to true.

Private Sub CheckBox1_Click()
If CheckBox1.value = False Then
Set ListView1.SelectedItem = Nothing
End If
End Sub

Check If Nothing Is Selected In Listview
I am using this code to check if any record has been selected in a listview, which works, except that now, the first column is just icons, and it always returns lvwItem = Nothing, even if a record is selected.
Is this because the text is in the second column?

Set lvwItem = lvwToDo.HitTest(x, y)

If Not lvwItem Is Nothing Then
lngToDoSelection = lvwToDo.SelectedItem.SubItems(2)
End If

Keep Row Selected After Reload (Listview)
I cannot find the correct way of doing this, although I have tried almost everything I can think of.

I have a listview with a selected record. This row is stored in 'lngRec' in the Listview_Click, subitem(19) is a hidden column that stores the primary key from the database.
I am using the following:

lngRec = lvwShowAll.SelectedItem.SubItems(19)

Now, I clear the listview, and then reload it with a recordset, sorting by dates.

What I cannot seem to work out is how to have the same record selected, even though it is in a different position.

Selected Subitem In A Listview
How do I determine which listview column has been clicked on?

Listview: Has Any Item Been Selected?
In a listview, how do I know whether any item has been selected? ListView.SelectedItem returns a number even if no line has been clicked on.

Remove Selected From ListView
I am createing a POS app and i would like to have it so you can select an item from the list and then have it remove by pressing Remove Item.

i Have just been havein it delete the first item in the list:

VB Code:
If lsvItems.ListItems.Count = "1" Then        lsvItems.ListItems.Remove (1)        cmdRemove.Enabled = False        Me.mnuVoidLastItem.Enabled = False    Else        lsvItems.ListItems.Remove (1)    End If

Listview Selected Question
lets say i have about 50 entries in the listview and i refresh the box every 60 secnds..

i do

ListView1.ListItems.item(id).Selected = True

to keep the selected id selected, after a refresh,

but if the id is the 50th one, after a refresh the listview scrolls up. this is annoying because then i have to scroll back down to the 50th entry

how can i stop this? how can i stop the listview from scrolling when i refresh it?

ListView Selected Item!
In a WebBrowser project, a ListView acts as the history window. This ListView comes up when the History button is clicked. Each URL is represented in the ListView by the title of that URL (like IE). For e.g. if the user has visited, it's title i.e. Yahoo! will get listed in the history ListView. Users have been given the option to delete any URL/s from the ListView.

Assume that currently I am viewing If the history ListView is now invoked, Yahoo! will be highlighted in the ListView (since I am presently viewing Suppose I delete any other URL in the ListView. Under such circumstances, the very first URL gets highlighted in the ListView but I want Yahoo! to remain highlighted in the ListView after that URL is deleted from. How do I accomplish this?

ListView Selected Item!
In a WebBrowser project, I am using a ListView which acts as a "history" window (like how IE opens a side-window when the history icon is clicked on the toolbar). As is evident, the ListView lists all the URLs that a user has visited.

When I click an item in the ListView, I want that after the appropriate web page gets downloaded completely, the item selected should remain highlighted which is why I have set the ListView's HideSelection property to False.

Assume that I click the 5th item in the ListView. When I do so, the selected URL gets highlighted & the browser navigates to the corresponding URL but after the web page gets downloaded completely, the first item in the ListView gets highlighted but I want the item that was clicked by the user should remain highlighted after the web page loads completely. In other words, I want the 5th item in the ListView to remain highlighted after the web page loads (since I had clicked the 5th item in the ListView). How do I implement this?

Whenever the ListView loads, the first item in the ListView is seen highlighted (as HideSelection is set to False) but I don't want the 1st item (or for that matter, any of the items) in the ListView to get highlighted whenever the ListView loads i.e. none of the items should be highlighted whenever the ListView loads. How do I do this?

Listview Selected Item
ok my app has a listview which has a check box in it. I have setup so that when someone clicks on an item, the selected item becomes checked. how do i set for when the item becomes checked, the item becomes selected???

hope i explained that correctly...

please help me code

Listview Selected Item
I have a listview on a form...
The item which is selected should be selected even if the form looses focus or unloads.
Next time when form gets focus that previously seleted item should be selected...........

How To Keep Listview Selected Row Highlighted
I have a listview and im useing the click even to tricker the display of another mini form, this form will contain options on which you can perform on the selected data in the previous list view.

The problem is, once i have called the other mini form and its loaded and sisplayed, the row that was selected in the listview becomes Un-highlighted

How can i keep the row i selected highlighted when i call other forms?

many thanks

Listview - Moving A Selected Row Up Or Down

I want to allow the user to order items in a listview according to their choice. So I need to move a selected row in a listview up or down (by pressing up or down command button). How can this effect be acheived ?



Listview Selected Index
The default ListView.Selected.Index is 1.. But i try ListView1.SelectedItem.Index = 2 after I populate the items.. but I encounter this error message;

"Property is read-only"

What code is right for this to select the 2nd row in ListView?

ListView Selected Item
Have any easy question about ListViews. When my form opens up the first item in my listview is selected. How would I keep this from happening? Do I need to loop through all items in the list view and set the selected property to false or is there an eaiser way. I would like to keep my load time down on my form.

Thanks ahead of time.

Listview Color Of Selected Row
dear all

for a listview control, when a user click a particular row, the entire row will be highlighted in BLUE while the font of that row is all white in color.

Can this default color be changed?

Determining If Nothing Selected In Listview
Is there a way to see if nothing in a listview is selected, preferably w/o looping through the whole thing? This is in embedded vb, btw. Selected a/o selecteditem don't work because nothing's selected. Thanks.

Listview Selected Item

I have a listview populated with a few dozen records from my database.
The listview has 10 column's. I try to make a change to for example the 3th record the 5th column. Althougt I select the 5th column always the first column of the 3th record is updatable.
How can I accomplish that I can select any cell of the listview to make an adjustment with I can send to my database.

I'm in great need for a solution, but can't (after a whole try and search) find it, plaese has someone a helping hand

With regard, thanx in advance


Counting Listview Selected
Is it possible to count the number of files in listview as they are being selected when you draw the dotted box using the mouse in the listview

e.g. as soon as a file in the listview goes blue when the dotted box created with the mouse goes over it. is it possible to count the number of files selected and put the value into a text box.

does anyone know how to do this???

Listview Selected Rows
how can i get the selected rows details from a listview??

some example codes with comments pls....
i will be grateful

Using The Item Selected In A Listview
private sub cmdClick_click()

If Not ListView1.SelectedItem Is Nothing Then
frmEditor.txtRecNumber.text=listview1.selectedItem.subitem _(1).text
end if

end sub

would this work for getting the items over to the editor page?
how can i make it so that when they double click on the row, it will go to the editor page?

Private Sub lvwLogBook_BeforeLabelEdit(Cancel As Integer)

End Sub
i dont think this is the right sub to use is it?

[ListView] Column Is Being Selected
I have a listview control, and I noticed late last night that if a row is selected, and I click on that row again, the system hightlights the contents of the first column, and allows me to edit them (as in if you used SelStart, etc on a textbox)

Obviously, I don't want this to happen, but I need to have the enabled property at TRUE. Is these some way of making a listview read-only?

ListView Selected Item
I want to know if there is a way to select an item in the
listview control and only have a portion of the item selected. For example, I want the first column of the selected item NOT to be highlighted but the rest of the columns to be highlighted. It works that way in the Outlook Express. Thanks.

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

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


Listview Not Showing Exactly What Was Selected
Let's say I have a program that randomly looks through a listview to select a file to open, and then it opens it.  I want the highlighted item on the listview to be what was selected but I can't seem to get the listview to move it's little scrollbars down to show the item, let alone select it.

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
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)

    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
    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


~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...


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
            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.



Listview Get Selected Listsubitem
I populate a listview with 12 columns, and want to retrieve the data of the selected listsubitem. With that data I want to filter contents of the listview.
So, when the selected data is listsubitem(i)='1990', then I want to filter the listview in a way that only the lines with 1990 in the listsubitem(i) data are displayed.
How to get this data? The user can click on any of the 12 listsubitems.

I populate it by code:
Private Sub FillListview()
Dim iClear As Long
Dim MyColumn As ColumnHeader
Dim iTelF As Long
Dim iTeller As Long
Dim sSelAct As String
Dim MyObject As adodb.Recordset

    Screen.MousePointer = vbHourglass

    lvwRapport.Visible = False

    If lvwRapport.ColumnHeaders.Count > 0 Then
        For iClear = 1 To lvwRapport.ColumnHeaders.Count
            lvwRapport.ColumnHeaders.Remove (lvwRapport.ColumnHeaders.Count)
    End If

    sRapport = "SELECT BezoekID as BezID, KlantID as Debnr, Bezoekrapportage.Regio, Rayon, Bezoekrapportage.Concern, KlantNaam as Klant, Gebruiker_Naam_Net as Behandelaar, " & _
               "Datum, PPrijsAf=CASE WHEN PPAfspraak=1 THEN 'V' ELSE '-' END, Actie, Verwerkt = CASE WHEN Actieind = 1 THEN 'V' ELSE '-' END, " & _
               "ConcI=CASE WHEN CCinfo=1 THEN 'V' ELSE '-' END, Status=CASE WHEN bezoekrapportage.BRStatus =1 THEN 'Alleen Lezen' ELSE 'Lezen/Schrijven' END " & _
               "FROM klanten RIGHT OUTER JOIN Bezoekrapportage ON klanten.klant_nr = Bezoekrapportage.KlantID " & _
               sFilt & " ORDER BY Datum DESC"
    Set Rs = New adodb.Recordset

    Rs.Open sRapport, cn, adOpenStatic, adLockReadOnly
    lvwRapport.View = lvwReport
    lvwRapport.CheckBoxes = False
    lvwRapport.FullRowSelect = True
    lvwRapport.AllowColumnReorder = True
    For iTelF = 0 To Rs.Fields.Count - 1
        lvwRapport.ColumnHeaders.Add , , Rs.Fields(iTelF).Name
    Next iTelF

    iTelF = 1
    lvwRapport.Sorted = False
    Do While Rs.EOF = False

    Set MyItem = lvwRapport.ListItems.Add(, "Rec" & iTelF, Rs!BezID)
        lvwRapport.ListItems(iTelF).ListSubItems.Add , "Debnr" & iTelF
        MyItem.ListSubItems(1).Text = Rs!Debnr
        lvwRapport.ListItems(iTelF).ListSubItems.Add , "Regio" & iTelF
        MyItem.ListSubItems(2).Text = Rs!regio
        lvwRapport.ListItems(iTelF).ListSubItems.Add , "Rayon" & iTelF
        MyItem.ListSubItems(3).Text = Rs!rayon
        lvwRapport.ListItems(iTelF).ListSubItems.Add , "Concern" & iTelF
        MyItem.ListSubItems(4).Text = Rs!concern
        lvwRapport.ListItems(iTelF).ListSubItems.Add , "Klant" & iTelF
        MyItem.ListSubItems(5).Text = Rs!Klant
        lvwRapport.ListItems(iTelF).ListSubItems.Add , "Behandelaar" & iTelF
        MyItem.ListSubItems(6).Text = Rs!Behandelaar
        lvwRapport.ListItems(iTelF).ListSubItems.Add , "Datum" & iTelF ', Rs!datum
        MyItem.ListSubItems(7).Text = Format(Rs!Datum, "dd-mm-yyyy")
        lvwRapport.ListItems(iTelF).ListSubItems.Add , "PPrijsaf" & iTelF
        MyItem.ListSubItems(8).Text = Rs!PPrijsaf
        lvwRapport.ListItems(iTelF).ListSubItems.Add , "Actie" & iTelF
        MyItem.ListSubItems(9).Text = Rs!Actie
        lvwRapport.ListItems(iTelF).ListSubItems.Add , "Verwerkt" & iTelF
        MyItem.ListSubItems(10).Text = Rs!verwerkt
        lvwRapport.ListItems(iTelF).ListSubItems.Add , "ConcI" & iTelF
        MyItem.ListSubItems(11).Text = Rs!conci
        lvwRapport.ListItems(iTelF).ListSubItems.Add , "Status" & iTelF
        MyItem.ListSubItems(12).Text = Rs!status


    iTelF = iTelF + 1
    Screen.MousePointer = vbDefault
    lvwRapport.Visible = True

End Sub

I'm searching all forums through and through, and don't see any solutions in getting variable listsubitems data, other than hardcoding a columnindexn. But my problem is that the user can click any of the listsubitems 1 - 11....

Any help would be much appreciated!


Selected Item In Listview
i am having a problem with selecting an item in a listview
any ideas ?

Private Sub Image4_Click()
Dim printdrwval As Variant
Dim vpcgetprintable As Variant
Dim testfileprintable As String
Dim zfile As String
Dim sprintername As String
Dim sprinterport As String
Dim selprintdraw As String

If msprinterdevicename = "" Then
  MsgBox "Select Printer", vbCritical
          Dim x As Integer
          For x = 0 To ListView1.ListItems.Count - 1
          If ListView1.SelectedItem.SubItems(x) = True Then ' I think this is wrong
selprintdraw = ListView1.SelectedItem.SubItems(x)
MsgBox selprintdraw, vbExclamation

'sprintername = (" XES Synergix 8825")
'sprinterport = (" \PARFSXerox 8825")

'zfile = Dir("c:pdfinfo.txt")
'If zfile = ("c:pdfinfo.txt") Then Kill ("c:pdfinfo.txt")

'vpcgetprintable = Shell("C:productcentercodePCgetviewableDebugPCgetviewable.exe " + Text1.Text, 1)
testfileprintable = Dir("c:pdfinfo.txt")
While testfileprintable = ""
    testfileprintable = Dir("c:pdfinfo.txt")
Open "c:pdfinfo.txt" For Input As 1
While Not EOF(1)
Line Input #1, printabledrawing
Debug.Print printabledrawing
Close 1
If printabledrawing = "error" Then
  MsgBox "Get Copy Not Successful", vbExclamation
  Kill ("c:pdfinfo.txt")
  drawtoprint = ("c: est" + printabledrawing)
  'If msprinterdevicename = "" Then
  'MsgBox "Select printer", vbExclamation
  'printdrwval = Shell(msacrobatpath & " /p" & " " & drawtoprint, 1)
  printdrwval = Shell(msacrobatpath & " /t " & drawtoprint & " " & Chr(34) & msprinterdevicename & Chr(34) & " " & Chr(34) & msprinterdevicename & Chr(34) & " " & Chr(34) & msprinterdrivername & Chr(34), 1)
  'Kill ("c:pdfinfo.txt")
  'Exit Sub
End If

 End If

         Next x
End If
End Sub

Copyright 2005-08, All rights reserved