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
Joined: Sun Apr 06, 2014 11:10 pm

Listview Items

Post by derhoeppi » Fri Oct 28, 2016 4:13 am

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: 13882
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Listview Items

Post by jvierra » Fri Oct 28, 2016 4:19 am

Try - $listview.CheckedItems

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

Re: Listview Items

Post by derhoeppi » Fri Oct 28, 2016 8:07 am

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: 13882
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Listview Items

Post by jvierra » Fri Oct 28, 2016 8:26 am

$listview.CheckedItems[0].SubItems

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

Re: Listview Items

Post by derhoeppi » Sun Oct 30, 2016 11:34 pm

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

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

Re: Listview Items

Post by jvierra » Mon Oct 31, 2016 12:45 pm

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

Locked