Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Send parameters to button.add_click function created dynamically

$
0
0

Hi,

I am creating a form with a TabControl that includes dynimically created TabPage, containing each on and off buttons.

The way it is currently done, I am struggling to get the object I am currently dealing with to make sure I apply what I want on the proper element.

On each TabPage I have

$btn_VMOff.add_Click({ (ClickOff $Idx) })

but $Idx is always empty Since I suspect it is keeping the variable as opposed to the value I would like to pass as a parameter.

I have tried with $($Idx), "$Idx", b ut it makes no difference.

Currently, my function ClickOff is as follow

Function ClickOff([string]$Parametre)
{ msgbox "Titre" $Parametre "Information"
}

Any idea on how to do this ?

Many Thanks.



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>