Powershell ComboBox Selection

This topic contains 1 reply, has 2 voices, and was last updated by  Dan Potter 1 year, 4 months ago.

  • Author
  • #65182

    Chris Eves

    Morning All,
    I am trying to use a Combobox to select three options.
    The first option hides a Labal & txtbox – The Second & Third show the Label & Textbox.
    I am currently having problems getting the code to work.

    If cboSpecialHandling.Text -eq "None") {$lbl.visible = $False}
    If cboSpecialHandling.Text -eq "Bob") {$lbl.visible = $True}

    The above works but I have to click the Combobox twice.

    I have tried the SelectedItemChanged and get nothing.

    Can anyone advise?

  • #65185

    Dan Potter

    Here is how we use the boolean assuming 'none' is the first item in your combobox.

    $label1.Visible = ($combobox1.SelectedIndex -gt 0)

You must be logged in to reply to this topic.