Always with listview

User avatar
sal21
PlatinumLounger
Posts: 4368
Joined: 26 Apr 2010, 17:36

Always with listview

Post by sal21 »

this is a part of code to fill a listview with icon:

Code: Select all

ICO=2
...
Set itmX = Me.ListView1.ListItems.Add(, , Format$(strDBRows(0, X), "#0000"), ICO)
itmX.SmallIcon = ICO
...
now i need wit a commandbutton to select the actuall row selected and change the the ICO=1
and instead to use the recordset i need to change the item with myvar=8500

possible?

User avatar
HansV
Administrator
Posts: 78600
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Always with listview

Post by HansV »

Try

Code: Select all

    With Me.ListView1.SelectedItem
        .Text = Format(MyVar, "0000")
        .Icon = 1
        .SmallIcon = 1
    End With
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4368
Joined: 26 Apr 2010, 17:36

Re: Always with listview

Post by sal21 »

HansV wrote:Try

Code: Select all

    With Me.ListView1.SelectedItem
        .Text = Format(MyVar, "0000")
        .Icon = 1
        .SmallIcon = 1
    End With
work perfect!

i need to update also the column 11 of listview with the row = ListView1.SelectedItem and with the value=1

User avatar
HansV
Administrator
Posts: 78600
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Always with listview

Post by HansV »

Something like

Code: Select all

    With Me.ListView1.SelectedItem
        .Text = Format(MyVar, "0000")
        .Icon = 1
        .SmallIcon = 1
        .SubItems(10) = 1
    End With
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4368
Joined: 26 Apr 2010, 17:36

Re: Always with listview

Post by sal21 »

HansV wrote:Something like

Code: Select all

    With Me.ListView1.SelectedItem
        .Text = Format(MyVar, "0000")
        .Icon = 1
        .SmallIcon = 1
        .SubItems(10) = 1
    End With
nO WORDS!
:thankyou: :thankyou: :thankyou: :clapping: :clapping: