Listview Items

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
derhoeppi
Posts: 34
Meble kuchenne na zamówienie - na wymiar - Wrocław
Joined: Sun Apr 06, 2014 11:10 pm

Listview Items

Post by derhoeppi »

Hi,

i created a GUI with a listview. Within my code i create some listview items (with one subitem) an publish them in my listview. Now i would use the checkoption to select some items an get them in an array. How is this possible?

$array = $listview1.selecteditems

does not work.

jvierra
Posts: 14353
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Listview Items

Post by jvierra »

Try - $listview.CheckedItems

User avatar
derhoeppi
Posts: 34
Joined: Sun Apr 06, 2014 11:10 pm

Re: Listview Items

Post by derhoeppi »

Hi,
okay this works. If i paste my Array with write-host i get the items. How is it possible to access the connected subitem?

jvierra
Posts: 14353
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Listview Items

Post by jvierra »

$listview.CheckedItems[0].SubItems

User avatar
derhoeppi
Posts: 34
Joined: Sun Apr 06, 2014 11:10 pm

Re: Listview Items

Post by derhoeppi »

Thanks for your help. Now i'm able to push, change and delete items from listview element.

jvierra
Posts: 14353
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Listview Items

Post by jvierra »

You are welcome. I am glad you were able to use it.

Locked