title: 2 listboxes selected items gui
body: <p>I have q GUI with 2 listboxes like so:
  <a href="https://i.stack.imgur.com/cISAc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cISAc.png" alt="enter image description here" /></a></p>
  <p>I have a function moving items from left to right like so:</p>
  <pre><code>Function MoveRight (){
      $x = $listbox1.selecteditems
       @($x) | ForEach-Object {[void] $Listbox2.Items.Add($_);
           [void]$Listbox1.Items.Remove($_)} 
  }
  
  Function moveLeft(){
      $x = $listbox2.selecteditems
       @($x) | ForEach-Object {[void] $Listbox1.Items.Add($_);
           [void]$Listbox2.Items.Remove($_)} 
  }
  </code></pre>
  <p>My goal is to take all the items that are currently on the right windows, and when the user press install- run a function to install them.</p>
  <p>But this will not happen because the user can put in the rightbox whatever he likes, if he wont click on them, they wont be selected.</p>
  <p>I was think of like a gloabal variable to hold the info when he's moving items from left to right but is there a better option to achive the goal?</p>