windowsformspowershellerrorprovider

Powershell error provider BlinkStyle


I might be going crazy but I can't seem to figure out how to set the blinkrate on an ErrorProvider in Powershell.

Error provider is defined with:

$Global:ErrorProvider = New-Object System.Windows.Forms.ErrorProvider

I've tried various different versions of:

$ErrorProvider.BlinkStyle() = [System.Windows.Forms.ErrorBlinkStyle.NeverBlink]

or

$ErrorProvider.SetBlinkStyle([System.Windows.Forms.ErrorBlinkStyle.NeverBlink])

With no success!

This is my first PS with some Windows forms elements so I'm still feeling my way through.


Solution

  • You specify an enum value like this in PowerShell:

    [System.Windows.Forms.ErrorBlinkStyle]::NeverBlink
    

    It is essentially like accessing a static member of a type. Try this:

    $ErrorProvider.BlinkStyle = [System.Windows.Forms.ErrorBlinkStyle]::NeverBlink