Click Event with Parameters

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.
Post Reply
User avatar
Bender2010
Posts: 5
Meble kuchenne na zamówienie - na wymiar - Wrocław
Joined: Thu Mar 22, 2018 8:03 am

Click Event with Parameters

Post by Bender2010 »

Hello together,

I have some buttons with a click event. The function behind the Click event have also a specific parameters, which is necessary to working. On my button, I could definde the function for the Click event, but where I can define the parameters for the funktion?
Event.PNG
Event.PNG (5.81 KiB) Viewed 87 times

Code: Select all

$buttonRev_Click={
	Param (
		[int]$RevisionNum
	)
	$tabpageLocations.Controls["textboxRev$($RevisionNum)"].Text = [int]($tabpageLocations.Controls["textboxRev$($RevisionNum)"].Text) + 1
}
- PowerShell Studio 5.7.173
- 64 bit version
- OS 64 bit.

Best regards

jvierra
Posts: 14213
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Click Event with Parameters

Post by jvierra »

You cannot use parameters on an event script block. The system calls that event and passes its own parameters. Yours will be over-written or ignored.

In Windows we get values in an event from the controls that contain the values or from script scoped variables.

User avatar
Bender2010
Posts: 5
Joined: Thu Mar 22, 2018 8:03 am

Re: Click Event with Parameters

Post by Bender2010 »

Okay, thank you for your information. I searching then for a another solution.

Best regards

Post Reply