PS Studio: invoke another object action in another object

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 6 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
stevens
Posts: 493
Last visit: Mon Sep 19, 2022 12:23 am
Has voted: 2 times

PS Studio: invoke another object action in another object

Post by stevens »

Hi,

I'd like to call for a certain action in a form in another action
I saw this post viewtopic.php?t=6716
but &$datagridviewGroup_CellDoubleClick does not work, neither is invoke-item $datagridviewGroup_CellDoubleClick

Please tell me howto make this work.
J.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: PS Studio: invoke another object action in another object

Post by jvierra »

Works fine for me but it must be done like this:

Code: Select all

$datagridview1_CellDoubleClick=[System.Windows.Forms.DataGridViewCellEventHandler]{
#Event Argument: $_ = [System.Windows.Forms.DataGridViewCellEventArgs]
	Write-Host 'Cell DoubleClick'
}

$buttonDoubleClickMe_Click={
	$datagridview1_CellDoubleClick.Invoke($this,$null)
}
This topic is 6 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked