Hashtable in Datagridview, how to order the columns

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.
This topic is 7 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
nloedbl
Posts: 1
Last visit: Thu Mar 01, 2018 3:35 am

Hashtable in Datagridview, how to order the columns

Post by nloedbl »

Product, version and build: Powershell studio 2016 5.2.128
32 or 64 bit version of product: 64
Operating system: Win10 Ent
32 or 64 bit OS: 64
PowerShell Version: 5

DO NOT POST SUBSCRIPTIONS, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM

Hi,

I'm new to Powershell studio and am trying to get a hashtable displayed in a datagridview (gui).
The actual display is working but the order of the columns is not as wished, how can I tell the 'Load-DataGridView -DataGridView $datagridview1 -Item $hashtable' in which order the colums should be displayed ?

Next issue would be to display a checkbox for one of the colums (Boolean) instead of the value
Any help is very much appreciated.

Thanks
Ed
DevinL
Posts: 1098
Last visit: Tue Jun 06, 2017 9:15 am

Re: Hashtable in Datagridview, how to order the columns

Post by DevinL »

[TOPIC MOVED TO POWERSHELL GUIS FORUM BY MODERATOR]
DevinL
SAPIEN Technologies, Inc.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Hashtable in Datagridview, how to order the columns

Post by jvierra »

Without a sampleof your code this is not going to be answerable.
Normally hashtables cannot be displayed in a grid. You would need to convert to an object and then make an arraylist. The gash can be ordered by using the [ordered] word.
$hash=[ordered]@{ ... }

Just add a column after the grid is loaded.

Adding a boolean to the hash will cause a checkbox to be displayed.
This topic is 7 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked