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.
This topic is 4 years and 10 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
Wburlingame

How to log Win Form user actions?

Post by Wburlingame »

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 »

To be specific, I only need the name of the button for logs.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: How to log Win Form user actions?

Post by jvierra »

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.
This topic is 4 years and 10 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