How to log Win Form user actions?

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.
Locked
Wburlingame

How to log Win Form user actions?

Post by Wburlingame » Wed Jun 12, 2019 11:09 am

I would like to log user button clicks. For testing and gathering info on what selection of tool options get used.
I have start-transcript, and tried on other logging tool but after the application launches there are no other log entries.

Do you have any suggestions on what might work best?
I am open to some easy global app option is available.
I do not need many filtering options.

Wburlingame

Re: How to log Win Form user actions?

Post by Wburlingame » Wed Jun 12, 2019 11:13 am

To be specific, I only need the name of the button for logs.

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

Re: How to log Win Form user actions?

Post by jvierra » Wed Jun 12, 2019 11:25 am

The only options are to add a log function and call it from each button. Ever control event has a hidden variable called "$this". You can use $this.Name to get the name of the button.

Locked