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 5 years and 4 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.
Trying to create a tool for managing services and in the process learn better gui design logic
Usage. Type in target(computer) query for services.
Search for a service or click.
Stop or Start the service. (working on the code for this)
When i press the stop button the service get stop but is there a way to refresh the gridview and reselect the service row I just stopped? right now it will select the first row in the gridview.
Did i use the wrong event for this? see error ind scr
The service objects are dynamic. They should update the grid if any property changes.
Your "service.Text" should be "$service.Text". It appears you forgot the "$".
Yes. That is how it works. How you use it is up to you. You need to understand how the service controller and forms work. This is a fairly big couple of items to understand,
I only showed art of how your issues have to be solved. There is another method that checks to see if any row is selected.
Also you must use a DataTable to allow for dynamic update to the row without having to refresh the whole grid. A DataTable also allows for dynamic sorting on any column and allows for more flexible searching. Sorting and search become one line solutions with a table.
I also discovered that you PSF files are corrupt. They appear to work but are missing important components and will eventually fail after certain edits.
I also started to modify your form to demonstrate how to set up a form that does what you are trying to do and allows for better control of the objects.
Here are some of the examples of ho to manage a form. The form will now no longer work correctly with any new controls due to the damaged PSF file.
It just locks up and makes edits behave erratically. n this case it is subtle. Some properties on newly added controls could not be changed and others didn't set properly. Dumping to a PS1 helps to find some of the issues.
This topic is 5 years and 4 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.