Powershell Help - Comboboxes

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

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

    I am rather new to Powershell coding and trying to cut down on some code.

    I have multiple ComboBoxes that have the same selection.

    How can I use the same lists for different Comboboxes but using minimum code?

    i.e. I have 10 Comboboxes that have the lists of Please Select, Yes, No.
    How can I get them to use the same line of code instead of individual code?

    #Adding Combobox Items to Toner Colour
        "Select","Yes","No" | ForEach-Object {$WPFcboPRToner.AddChild($_)}
        $WPFcboPRToner.SelectedIndex = 0
    

    So in the code I want other comboboxes to use this without duplicating code.

    Thanks All.

    Chris

  • #66843
    Profile photo of Graham Beer
    Graham Beer
    Participant

    Add the line(s) of code to a variable and use the variable.

You must be logged in to reply to this topic.