 |
|
 |
I'm not sure what I'm doing wrong but I've added the class to my project that I would like to implement this on then added the Form load code. Nothing happens even when I tied a button click to increment the value.
What am I missing?
Dim progress1 As ProgressStatus
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
progress1 = New ProgressStatus(StatusBar1) 'the new MUST be here, because statusbar must be loaded first!
With progress1
.Style = StatusBarPanelStyle.OwnerDraw
.MinWidth = 200
.BorderStyle = StatusBarPanelBorderStyle.Raised
End With
StatusBar1.Panels.Add(progress1)
Show()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
progress1.progress = progress1.progress + 10
Application.DoEvents()
End Sub
|
|
|
|
 |
|
 |
Update: Didn't have StatusBar1.ShowPanels = True. Added that and it works!!
|
|
|
|
 |
|
 |
Please let me know how to set trial period for our application. so that it would not work after one month from the time of instalation? please help me. its urgent.
Isha
|
|
|
|
 |
|
 |
Hi,
I have placed the progressbar in a status bar on a windows form. On the same form I have several buttons, each of which loads a crystal report. On the click of the button I write progress1.progress = -1
Then I do the crystal report loading and at the end I write progress1.progress = 0
I do the same for each button. When I run the app, the first button I click, the progress bar shows correctly and stops when the report is loaded. Any subsequent button I click including the first button, the progress bar shows just for a second and disappears, though the report is still loading.
Any suggestions would be greatly appreciated.
Thanks.
|
|
|
|
 |
|
 |
Hi,
With your statusbar, how do i giving a status while the aplication loading sql query, like while running query for viewing table, when the viewing is finish, the animation is stop
Regard,
Abbas
-- modified at 6:27 Monday 17th July, 2006
|
|
|
|
 |
|
 |
Hi- Great tool and I hope folks are still using it. My Q is, I'm running this only during a certain part of my program... so I need to remove it from its panel... but no matter what I have tried it just keeps on bouncing.
Any thoughts?
Thanks. Gordon
|
|
|
|
 |
|
 |
Hi,
First time in my life that I touch VB .NET, and really knows nothing about VB6 either. I'm doing rather well in my first application
I finally after about 2 or so hours managed to get this working... It's definately allot more complicated than simply adding a couple of lines of code - but I guess that's to be expected.
Anyways,
What I was wondering... Now that I have my status BAR going ape in blue and looking all funky and stuff... To the left hand side of the bar, I have a 'status'. Is it possible to manipulate that?
I'd like to add some status messages here as far as my data downloads go that I get via HTTPS... i.e.
- Resolving Hostname
- Contacting Site
- Downloading (xx% Complete)
etc etc etc???
I've looked through the class, but I couldn't find anything (perhaps I looked for the wrong stuff), but if anyone can shed some light, I'd appreciate it allot.
Thanks,
Chris.
|
|
|
|
 |
|
 |
Me.Status.Text
How simple can it be, hehehehe
Thanks anyway, and thanks for the very nice code indeed.
|
|
|
|
 |
|
 |
When I use your progress in statusbar with progress=-1 and my programm have to do hard work the progress stand still. There is nothing happen to the progressbar.
I think it must be threading, but I do not know who?
Steffen
|
|
|
|
 |
|
 |
thx
i'm going to testit, page will be updated soon
|
|
|
|
 |
|
 |
Try adding Windows.Forms.Application.DoEvents() inside loop(s) where you code is running ... this allows the form controls to draw during intensive system processes.
|
|
|
|
 |
|
 |
after investigating the problem this also would be my answer!
|
|
|
|
 |
|
 |
DoEvents is not everytime possible. For example I want to show the endless bar while connecting to a database. In this case this can persist a few seconds and I can not make a DoEvents because it is only one command. In this time the progress bar do not move.
So I think we must use a other thread?!
Steffen
|
|
|
|
 |
|
 |
so put your database-connection code into an own thread, so that it does not hold the GUI:
sample:
Private Sub Button1_Click(...) Handles Button1.Click
Dim t As System.Threading.Thread = New System.Threading.Thread(AddressOf dosomething)
t.Start()
End Sub
Private Sub dosomething()
'here should be your command
'sleep only used for example purpose
System.Threading.Thread.Sleep(10000)
End Sub
|
|
|
|
 |
|
 |
Hy thomasdev,
thanks for your example, but I use some operations (databse connection was only an example) which I can not simply put in a own thread. This was the reason to my question for a own progressbar thread!
Steffen
|
|
|
|
 |
|
 |
The problem with DoEvent is that it allows the manipulation of the other controls in the form.
I'm developping a form that has several controls to define the search for items, a status bar where I would like to insert your control and a button to launch the search.
Here is an extract of the OnButtonClick function:
System.Windows.Forms.Cursor.Current = Cursors.WaitCursor
progress1.progress = -1 ' start your animated control
fillThread = New Threading.Thread(AddressOf SearchFunction)
fillThread.Start()
Do While fillThread.IsAlive
Application.DoEvents()
System.Threading.Thread.Sleep(1)
Loop
fillThread = Nothing
...
System.Windows.Forms.Cursor.Current = Cursors.Default
The DoEvent reset the mouse cursor to the default pointer instead of the WaitCursor.
If I add the instruction to change it in the loop, the mouse cursor is ok, but the user has access to all the controls in the form (he can change the values, click again on the search button and even close the form!)
Is there another way to make the control move than DoEvent ?
Thanks
David
|
|
|
|
 |
|
 |
you could get a simple workaround hack by adding the following to the class:
Public Sub Refresh()
Me.pb.Refresh()
End Sub
and your mainloop:
Do While fillThread.IsAlive
'no more doevents!
System.Threading.Thread.Sleep(250)
'not too fast!
progress1.refresh()
Loop
but i would assume that you should lock all your controls when the search is started and the form-closure can be canceld. this is the much better solution because if the "window not reacting" warning appears in winxp, all drawing is impossible
your mainloop could also be made better with a callback signal, instead of looping senseless, i think
greetings
thomas
|
|
|
|
 |
|
 |
You can probably get around the flickering with a bit of double-buffering (render the control on an offscreen surface then do a bitblt from that offscreen surface to the screen).
Joel Johnson
|
|
|
|
 |
|
 |
the bitblt doesnt work for me, the new solution should work also without flickering
|
|
|
|
 |