none
How to set default value in ListBox using powershell? RRS feed

  • Question

  • I have a simple ListBox like this:
    $objListBox = New-Object System.Windows.Forms.ListBox
    $objListBox.Location = New-Object System.Drawing.Size(10,40)
    $objListBox.Size = New-Object System.Drawing.Size(260,20)
    $objListBox.Height = 80

    [void] $objListBox.Items.Add("One")
    [void] $objListBox.Items.Add("Two")
    [void] $objListBox.Items.Add("Three")
    $objForm.Controls.Add($objListBox)

    When it run, there is no item selected by default. How can make "Two" to be selected by default when the form initiate?

    Thanks.
    Tuesday, June 30, 2009 12:37 AM

Answers

All replies