简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM