1

次の点で助けが必要です。

これはコマンドレットです

Set-Datastore [-Datastore] <Datastore[]> [[-Name] <String>] [-CongestionThresholdMillisecond <Int32>]

「-CongestionThresholdMillisecond」パラメータで使用されるテキスト ボックスがあります。私はさまざまな方法で疲れましたが、get が文字列を int に変換できないか、値が 5 未満です (許可されていません)。

$textBox417.Size = New-Object Drawing.Size (80,30)
$textBox417.Location = New-Object System.Drawing.Size (100,140)
$int = $textBox417.Value.ToString() 
$button = New-Object System.Windows.Forms.Button
$button.Size = New-Object Drawing.Size (110,30)
$button.Location = New-Object System.Drawing.Size (50,180)
$button.add_click({Set-Datastore -Name $label438.Text -CongestionThresholdMillisecond $int})

大変助かりました!

4

2 に答える 2

1

存在しないプロパティを参照しているようです。Value プロパティを Text プロパティに変更してみてください

$int = $textBox417.Text
于 2013-03-21T17:11:11.977 に答える
0

テキストボックスから正しい数値を取得できれば、文字列を int に変更するのは簡単です。

$string = '123'
$string.gettype()
([int]$string).gettype()

ではなぜできないのか

...
$button.add_click({Set-Datastore -Name $label438.Text -CongestionThresholdMillisecond ([int]$int)})
于 2013-03-22T03:26:07.810 に答える