Search found 12897 matches

by jvierra
Mon Nov 19, 2018 6:44 am
Forum: PowerShell GUIs
Topic: Get-Credential and Validate
Replies: 1
Views: 59

Re: Get-Credential and Validate

The only way to validate credentials is to try and use them.
by jvierra
Sun Nov 18, 2018 3:11 pm
Forum: PowerShell GUIs
Topic: GUI - Display data - table format - color? how?
Replies: 47
Views: 1054

Re: GUI - Display data - table format - color? how?

Sorry. I typed it wrong and didn't see it. It should be: if(-not $listview1.Groups[$Group]){ With this we wouldn't add groups in the designer we would just create them as needed. This also allows the code to explicitly state how and why groups are created rather than hiding them in the designer.
by jvierra
Sun Nov 18, 2018 1:42 pm
Forum: PowerShell GUIs
Topic: GUI - Display data - table format - color? how?
Replies: 47
Views: 1054

Re: GUI - Display data - table format - color? how?

We can now also do this and have the groups auto-generated: function Add-ListViewSubItems{ param( $Property, $Value, $GroupName ) if(-not $listview1.Groups[$Group]){ $lvGroup = [System.Windows.Forms.ListViewGroup]::New($GroupName,$GroupName) $listview1.Groups.Add($lvGroup) } $item = New-Object Syste...
by jvierra
Sun Nov 18, 2018 1:32 pm
Forum: PowerShell GUIs
Topic: GUI - Display data - table format - color? how?
Replies: 47
Views: 1054

Re: GUI - Display data - table format - color? how?

For future reference. Here is how to further simplify the build process. This function does al of the item creation: function Add-ListViewSubItems{ param( $Property, $Value, $Group ) $item = New-Object System.Windows.Forms.ListViewItem $listview1.Items.Add($item) $item.Text = $Property $item.Name = ...
by jvierra
Sun Nov 18, 2018 1:18 pm
Forum: PowerShell GUIs
Topic: GUI - Display data - table format - color? how?
Replies: 47
Views: 1054

Re: GUI - Display data - table format - color? how?

Note. You don't have to do this: Value = "$($sysCompp.Version)" Just assign directly: Value = $sysCompp.Version It is never necessary to add quotes when assigning values to a property. It is then not necessary to use a subexpression evaluator to extract a property. This is how to use cariables and p...
by jvierra
Fri Nov 16, 2018 4:12 pm
Forum: PowerShell GUIs
Topic: Export Datagridview to CSV
Replies: 11
Views: 303

Re: Export Datagridview to CSV

Here is an example of an incremental load.
by jvierra
Fri Nov 16, 2018 4:10 pm
Forum: PowerShell GUIs
Topic: Export Datagridview to CSV
Replies: 11
Views: 303

Re: Export Datagridview to CSV

Just add rows to the DataTable as you need. Once bound to the grid they will show automatically. I have used a grid for a dynamic logger and to dynamically display the results of a job as they arrived.
by jvierra
Fri Nov 16, 2018 2:11 pm
Forum: PowerShell GUIs
Topic: GUI - Display data - table format - color? how?
Replies: 47
Views: 1054

Re: GUI - Display data - table format - color? how?

That is the same code I asked you to turn into an object collection. Now just convert the collection to a DataTable or change it to create a DataTable. Create the table and columns and add each item to the table as a row. $dt.Rows.Add($property, $value, $group) Add the DataTable to the DGV DataSourc...
by jvierra
Fri Nov 16, 2018 1:35 pm
Forum: PowerShell GUIs
Topic: Export Datagridview to CSV
Replies: 11
Views: 303

Re: Export Datagridview to CSV

You need to start with a DataTable. Why is that so hard? Just convert your object collection to a DataTable.

Post the code that loads your grid and I will give you an example.
by jvierra
Fri Nov 16, 2018 1:19 pm
Forum: PowerShell GUIs
Topic: Export Datagridview to CSV
Replies: 11
Views: 303

Re: Export Datagridview to CSV

See the following example: