Author Posts

October 25, 2017 at 1:18 am

Hi ,
I want to display a progress bar within a column inside a datagridview .
Sample code below. I want Column 3 to show a progress bar with 70% used bar instead of just the boring text 70.
Please help

CLS
 Add-Type -AssemblyName System.Windows.Forms
    Add-Type -AssemblyName System.Drawing

    
        
    $Form = New-Object system.Windows.Forms.Form
    $Form.StartPosition = "CenterScreen"
    $Form.Topmost = $True
    $Form.size = New-Object System.Drawing.Size(400,400)
    
    $row = @( "A1", "B1" , "70" )

    $dataGridView = New-Object 'System.Windows.Forms.DataGridView'
    $dataGridView.Location = '5,15'
    $dataGridView.Size = '440,575'
     
    $dataGridView.Dock = 'Fill'
    $dataGridView.AutoSizeColumnsMode = 'DisplayedCells'
    $dataGridView.AllowUserToAddRows= $false
    $dataGridView.ReadOnly = $True
     
    $dataGridView.AllowUserToOrderColumns = $True
    $dataGridView.AllowUserToResizeColumns = $True
    $dataGridView.AllowUserToResizeRows = $True
    
    $dataGridView.ColumnCount = 3
    
    $dataGridView.ColumnHeadersVisible = $true

    $dataGridView.Rows.Add($row)

    $Form.Controls.Add($dataGridView)
    
    $Form.ShowDialog()

October 25, 2017 at 1:21 am

This link does what I want to do , but its in C#. Can someone please show me an example in POWERSHELL.

https://www.codeproject.com/Articles/117021/How-to-Create-ProgressBar-Column-in-DataGridView