winforms - Creating a progress bar for a search function -


i trying make progress bar in powershell generated gui show progress of search system caches groups in ad (there 12,000 otherwise causes system hang short while)

i managed build bar etc cannot fill bar system adds groups. here have far:

[reflection.assembly]::loadwithpartialname("system.windows.forms") | out-null [reflection.assembly]::loadwithpartialname("system.drawing") | out-null  $form = new-object system.windows.forms.form $form.width = 345 $form.height = 345 $form.startposition = "centerscreen" $form.showintaskbar = $true $form.formborderstyle = 'fixedtoolwindow'  $exitbutt = new-object system.windows.forms.button $exitbutt.location = new-object system.drawing.size(235,5) $exitbutt.size = new-object system.drawing.size(100,20) $exitbutt.text = "exit" $form.controls.add($exitbutt) $exitbutt.add_click({$form.close()})  $prog = new-object system.windows.forms.progressbar $prog.maximum = 10000 $prog.minimum = 0 $prog.location = new-object system.drawing.size(50,50) $prog.size = new-object system.drawing.size(100,50) $form.controls.add($prog)  $button = new-object system.windows.forms.button $button.location = new-object system.drawing.size(120,100) $button.size = new-object system.drawing.size(100,30) $button.text = "start progress" $form.controls.add($button) $button.add_click(     {     $groupslist = get-adgroup -server "server" -filter *     $count = ($groupslist | measure-object).count     $prog.value = $count     }     ) $form.showdialog() | out-null 

to update winforms progressbar set value property.

eg.

# initialisation... $myprogbar.minimum = 1; $myprogbar.maximum = 100;  # when happens... $myprogbar.value = 50; 

will set half way.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -