Hi
I am trying to get a progress bar working in my form, not having much luck. I have started a small basic script to help me better understand the functions of progress bars in forms, but even this is causing me trouble. Here is the code:
[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null [reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null $form_main = New-Object System.Windows.Forms.Form $progressBar1 = New-Object System.Windows.Forms.ProgressBar $timer1 = New-Object System.Windows.Forms.Timer $form_main.Text = 'ProgressBar demo' $progressBar1.DataBindings.DefaultDataSourceUpdateMode = 0 $progressBar1.Step = 1 $progressBar1.Name = 'progressBar1' $progressBar1.Maximum = 100 $progressBar1.Minimum = 0 $form_main.Controls.Add($progressBar1) $timer1.Interval = 1000 $timer1.add_tick($timer1_OnTick) $timer1.Start() $form_main.ShowDialog()| Out-Null $timer1_OnTick = { $progressBar1.Increment(1) }
I thought that this code would draw a progress bar that increments 1% each second, until it reaches 100%/100 seconds, but all it does is flip around like a fish out of water :S