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 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.
The message box doesn't come up with [System.Windows.Forms.MessageBox]::Show( $res.Count) or updating a form property (textbox) within the CompletedScript. It does work outside of the Completed script. I created a separate button with the following code, keeping it simple and the value of $res.Count is 0.
I looked at your code and it is horribly broken in many, many places. I did not fix it but used your form to show how the JobTracker works.
Run the form attached to see how it works. Throw out your code and rethink what you are trying to do.
As I posted earlier, you need to go back and carefully read the blog post until you fully understand how this needs to work.
It takes about one step to create a tracker and a few edits to update the code. Stop trying to be so fancy before you even have a working tracker. Your fancy things are breaking the tracker and the form.
I got rid of my "horribly" written code/wsf file and created one from scratch to reference what you had change/coded for the routine. Does the file/code you provided work, yes. Taking the pieces of what you added and putting them on my newly created wsf file it doesn't seem to update (got rid of my code so I could try and understand/debug through it). The progressbar or the datagrid don't update at all. Sorry I am just getting really frustrated with this as I expected either copying and pasting the code from the example/article or the code you provided would work and then I would go through the motion of testing/debugging like you want me too. I am not trying to give you a hard time at all and appreciate the help you have provided so far. What you coded up doesn't exactly do what I need it to do, as i want the progressbar to be the number of files or in my example that i had, the number of computer objects. The code you provided and the example in the article is giving the progressbar a random number to increase and set max.
I have attached the new form/wsf file with the example code you just provided back, can you tell me why please what I am missing?
Well you need to spend the time to learn how to create a form with PSS. YOu are just copying code around with no concept of how to build a form.
Go back to the article and read it carefully. Try all of the examples until you understand what they are trying to show you. You cannot learn forms in 10 minutes. Even experienced programmers take days to finally understand how Windows works. It cannot be guessed at if you are not already an experienced programmer. The articles in the info center will help you to understand controls and how forms are managed through events.
Start by creating a new form and adding the JobTracker control set and then run the form. That takes about 2 minutes and is a good place to start.
1. Create new dialog form.
2. Drop "Button - Start Job" on form.
3. Click "Run"
4. Click "Start" button.
I know how to create a form in PSS, as how did i magically create the form/example when i started this thread which everything was working fine. Just want to have a responsive form when Get-AdComputer was called/used. Anyways...
Is there anyway to know in PSS if a set value for a control is set/changed from default in the properties vs hard coding it (which you would know right away)?
To understand how the controls properties work I recommend reading the documentation for PSS. It is available on the help menu as "Product Manual". This will give you a structured overview of how to use PSS.
Unfortunately we cannot teach you how to use PSS or how to design and code forms. There are books available on how t design and code forms however they are all in C# and VB.Net but the lessons are mostly transferrable.
How does this simple question, which is a yes or no response get a reply of this? Copying and pasting from a script?
The question:
Is there anyway to know in PSS if a set value for a control is set/changed from default in the properties vs hard coding it (which you would know right away)?
jvierra: I am good from here, i see i am not getting anywhere/help with the questions i am asking. Will try to figure it out on my own. Thanks,
Look at the properties pane. What happens when you change a property?
-- My point is if you manually change a property on a control is it stored somewhere to reference. Vs if you hard coded it in your code on a control you would know as the code is listed in the control.
Control Sets...
Based on your wording you are stating that there are built in control sets to add to the form on a control once created. When I right click on a control, example button i don't see add control set, just create control set.
I am running PSS on Windows 10, installed version 5.4.136.
Start by creating a new form and adding the JobTracker control set and then run the form. That takes about 2 minutes and is a good place to start.
1. Create new dialog form.
2. Drop "Button - Start Job" on form.
3. Click "Run"
4. Click "Start" button.
This topic is 6 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.