Powershell ComboBox Selection

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Dan Potter Dan Potter 5 months ago.

  • Author
    Posts
  • #65182
    Profile photo of Chris Eves
    Chris Eves
    Participant

    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.

    
    $cboSpecialHandling.Add_Click({
    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
    Profile photo of Dan Potter
    Dan Potter
    Participant

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

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

You must be logged in to reply to this topic.