How to load DataGridView, one line at a time?

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.
User avatar
Posts: 23
Joined: Fri Sep 27, 2013 1:29 pm

How to load DataGridView, one line at a time?

Post by BThomson1984 »


I'm wondering if it's possible to load the DataGridView, one line at time?

For example, this code below, it would be great for the event logs to be displayed as soon as they are parsed, one line at a time.

I was able to do this when using out-gridview, and it worked great, however, if this is possible with DataGridView, that would be even better.
PowerShell Code
Double-click the code block to select all.
$log = Get-EventLog -LogName $comboBox1.SelectedItem -Newest $Ammount.text -EntryType Error, Warning -ComputerName $ComputerName.text | 
	                            Select-Object MachineName, Message, EventID, EntryType, TimeGenerated, Source
	                                Load-DataGridView -DataGridView $datagridview1 -Item $log