By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,092 Members | 1,597 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,092 IT Pros & Developers. It's quick & easy.

Progress Form

P: n/a
I have a form that takes some time to load because it has to populate
some Data. I was trying to display a form on top of it with an
activity bar so that user can see that something's going on.

I have tried doing this and using a progress bar that counts up to 100
and then zeros down so that it should be constantly moving while the
main or background windows finishes loading.

The problem is that the "in progress window" doesn't display its
controls until the background window has finished its process, which
eliminates the sense of the progress window.

code is something like this

sub mainform_load()
dim frmProgress as New ProgressWindow
frmProgress.ShowDialog()

StartUpProcess()
end sub

with this one, mainform does nothing

while with this other, progress windows is not displayed until start
up process is not done

sub mainform_load()
StartUpProcess()

dim frmProgress as New ProgressWindow
frmProgress.ShowDialog()
end sub

As usual, I appreciate your help...
Nov 20 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
* Pepi Tonas <Pe*******@hotmail.com> scripsit:
I have a form that takes some time to load because it has to populate
some Data. I was trying to display a form on top of it with an
activity bar so that user can see that something's going on.

I have tried doing this and using a progress bar that counts up to 100
and then zeros down so that it should be constantly moving while the
main or background windows finishes loading.

The problem is that the "in progress window" doesn't display its
controls until the background window has finished its process, which
eliminates the sense of the progress window.


You will have to do the background processing in a separate thread.

<http://www.devx.com/dotnet/Article/11358>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2

P: n/a
Cor
Hi Pepsi,

I have still not used it myself so not tested, but I saved it very well
maybe you can try it.

\\\By Armin Zingler
In a new project, add a button to the Form. Also add the following code:

Private m_Thread As MyThread

Private Sub Button1_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click

m_Thread = New MyThread
AddHandler m_Thread.Progress, AddressOf OnProgress
AddHandler m_Thread.Done, AddressOf OnDone
m_Thread.Start()
End Sub

Public Delegate Sub ProgressDelegate(ByVal Progress As Integer)

Private Sub OnProgress(ByVal Progress As Integer)
If Me.InvokeRequired Then
Me.Invoke(New ProgressDelegate( _
AddressOf OnProgress _
), New Object() {Progress})
Else
Me.Button1.Text = Progress.ToString
End If
End Sub

Private Sub OnDone()
m_Thread = Nothing
End Sub
////
Class MyThread
Public Event Progress(ByVal Progress As Integer)
Public Event Done()

Private m_Thread As Thread

Public Sub Start()
m_Thread = New Thread(AddressOf ThreadStart)
m_Thread.Start()
End Sub

Private Sub ThreadStart()
Dim i As Integer
For i = 1 To 100
Thread.Sleep(100)
RaiseEvent Progress(i)
Next
RaiseEvent Done()
End Sub

End Class

I hope this helps a little bit?

Cor

"> I have a form that takes some time to load because it has to populate
some Data. I was trying to display a form on top of it with an
activity bar so that user can see that something's going on.

I have tried doing this and using a progress bar that counts up to 100
and then zeros down so that it should be constantly moving while the
main or background windows finishes loading.

The problem is that the "in progress window" doesn't display its
controls until the background window has finished its process, which
eliminates the sense of the progress window.

code is something like this

sub mainform_load()
dim frmProgress as New ProgressWindow
frmProgress.ShowDialog()

StartUpProcess()
end sub

with this one, mainform does nothing

while with this other, progress windows is not displayed until start
up process is not done

sub mainform_load()
StartUpProcess()

dim frmProgress as New ProgressWindow
frmProgress.ShowDialog()
end sub

As usual, I appreciate your help...

Nov 20 '05 #3

P: n/a
thanks...

On 13 Jan 2004 08:21:57 +0100, hi***************@gmx.at (Herfried K.
Wagner [MVP]) wrote:
* Pepi Tonas <Pe*******@hotmail.com> scripsit:
I have a form that takes some time to load because it has to populate
some Data. I was trying to display a form on top of it with an
activity bar so that user can see that something's going on.

I have tried doing this and using a progress bar that counts up to 100
and then zeros down so that it should be constantly moving while the
main or background windows finishes loading.

The problem is that the "in progress window" doesn't display its
controls until the background window has finished its process, which
eliminates the sense of the progress window.


You will have to do the background processing in a separate thread.

<http://www.devx.com/dotnet/Article/11358>


Nov 20 '05 #4

P: n/a
Thanks...

On Tue, 13 Jan 2004 09:19:10 +0100, "Cor" <no*@non.com> wrote:
Hi Pepsi,

I have still not used it myself so not tested, but I saved it very well
maybe you can try it.

\\\By Armin Zingler
In a new project, add a button to the Form. Also add the following code:

Private m_Thread As MyThread

Private Sub Button1_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click

m_Thread = New MyThread
AddHandler m_Thread.Progress, AddressOf OnProgress
AddHandler m_Thread.Done, AddressOf OnDone
m_Thread.Start()
End Sub

Public Delegate Sub ProgressDelegate(ByVal Progress As Integer)

Private Sub OnProgress(ByVal Progress As Integer)
If Me.InvokeRequired Then
Me.Invoke(New ProgressDelegate( _
AddressOf OnProgress _
), New Object() {Progress})
Else
Me.Button1.Text = Progress.ToString
End If
End Sub

Private Sub OnDone()
m_Thread = Nothing
End Sub
////
Class MyThread
Public Event Progress(ByVal Progress As Integer)
Public Event Done()

Private m_Thread As Thread

Public Sub Start()
m_Thread = New Thread(AddressOf ThreadStart)
m_Thread.Start()
End Sub

Private Sub ThreadStart()
Dim i As Integer
For i = 1 To 100
Thread.Sleep(100)
RaiseEvent Progress(i)
Next
RaiseEvent Done()
End Sub

End Class

I hope this helps a little bit?

Cor

"> I have a form that takes some time to load because it has to populate
some Data. I was trying to display a form on top of it with an
activity bar so that user can see that something's going on.

I have tried doing this and using a progress bar that counts up to 100
and then zeros down so that it should be constantly moving while the
main or background windows finishes loading.

The problem is that the "in progress window" doesn't display its
controls until the background window has finished its process, which
eliminates the sense of the progress window.

code is something like this

sub mainform_load()
dim frmProgress as New ProgressWindow
frmProgress.ShowDialog()

StartUpProcess()
end sub

with this one, mainform does nothing

while with this other, progress windows is not displayed until start
up process is not done

sub mainform_load()
StartUpProcess()

dim frmProgress as New ProgressWindow
frmProgress.ShowDialog()
end sub

As usual, I appreciate your help...


Nov 20 '05 #5

P: n/a
Hi Pepi,

To do what you want you would need to use more than one thread.

Craig VB.Net Team
--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).

--------------------
From: Pepi Tonas <Pe*******@hotmail.com>
Newsgroups: microsoft.public.dotnet.languages.vb
Subject: Progress Form
Date: Mon, 12 Jan 2004 22:48:44 -0400
Lines: 36
Message-ID: <ol********************************@4ax.com>
NNTP-Posting-Host: sju-204-250-22-142.prw.net (204.250.22.142)
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de 1073962124 12230890 204.250.22.142 ([213891])
X-Newsreader: Forte Free Agent 1.93/32.576 English (American)
Path: cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.phx.gbl!TK2MSFTNGP08
.phx.gbl!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!f
u-berlin.de!uni-berlin.de!sju-204-250-22-142.prw.NET!not-for-mailXref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.languages.vb:172335
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

I have a form that takes some time to load because it has to populate
some Data. I was trying to display a form on top of it with an
activity bar so that user can see that something's going on.

I have tried doing this and using a progress bar that counts up to 100
and then zeros down so that it should be constantly moving while the
main or background windows finishes loading.

The problem is that the "in progress window" doesn't display its
controls until the background window has finished its process, which
eliminates the sense of the progress window.

code is something like this

sub mainform_load()
dim frmProgress as New ProgressWindow
frmProgress.ShowDialog()

StartUpProcess()
end sub

with this one, mainform does nothing

while with this other, progress windows is not displayed until start
up process is not done

sub mainform_load()
StartUpProcess()

dim frmProgress as New ProgressWindow
frmProgress.ShowDialog()
end sub

As usual, I appreciate your help...



Nov 20 '05 #6

P: n/a
Adding to what Craig said:

Start a second thread for your StartUpProcess and do your long running task.
In your current process, start the progress dialog. You will have to think
of a way to inturrupt and close your progress dialog when your long running
process has finished.

The trick here is, and problem I've seen other run into is; make sure you
run your progress dialog on the UI Thread, as if you don't... you could get
some strange results.

I could throw together a quick sample for you if you want, and also, I have
an 'infinite progress' control that is styled after the Windows 2000 boot
screen - if you think this would help, just let me know.

Cheers,
Lubos

"Craig Vick [MSFT]" <cr*****@online.microsoft.com> wrote in message
news:VC**************@cpmsftngxa07.phx.gbl...
Hi Pepi,

To do what you want you would need to use more than one thread.

Craig VB.Net Team
--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).

--------------------
From: Pepi Tonas <Pe*******@hotmail.com>
Newsgroups: microsoft.public.dotnet.languages.vb
Subject: Progress Form
Date: Mon, 12 Jan 2004 22:48:44 -0400
Lines: 36
Message-ID: <ol********************************@4ax.com>
NNTP-Posting-Host: sju-204-250-22-142.prw.net (204.250.22.142)
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de 1073962124 12230890 204.250.22.142 ([213891])
X-Newsreader: Forte Free Agent 1.93/32.576 English (American)
Path:

cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.phx.gbl!TK2MSFTNGP08 phx.gbl!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!f u-berlin.de!uni-berlin.de!sju-204-250-22-142.prw.NET!not-for-mail
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.languages.vb:172335
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

I have a form that takes some time to load because it has to populate
some Data. I was trying to display a form on top of it with an
activity bar so that user can see that something's going on.

I have tried doing this and using a progress bar that counts up to 100
and then zeros down so that it should be constantly moving while the
main or background windows finishes loading.

The problem is that the "in progress window" doesn't display its
controls until the background window has finished its process, which
eliminates the sense of the progress window.

code is something like this

sub mainform_load()
dim frmProgress as New ProgressWindow
frmProgress.ShowDialog()

StartUpProcess()
end sub

with this one, mainform does nothing

while with this other, progress windows is not displayed until start
up process is not done

sub mainform_load()
StartUpProcess()

dim frmProgress as New ProgressWindow
frmProgress.ShowDialog()
end sub

As usual, I appreciate your help...


Nov 20 '05 #7

P: n/a
On Fri, 16 Jan 2004 17:02:47 -0800, "Lubos Hrasko"
<lu***@NO-microcafe.net-SPAM> wrote:
Adding to what Craig said:

Start a second thread for your StartUpProcess and do your long running task.
In your current process, start the progress dialog. You will have to think
of a way to inturrupt and close your progress dialog when your long running
process has finished.

The trick here is, and problem I've seen other run into is; make sure you
run your progress dialog on the UI Thread, as if you don't... you could get
some strange results.

I could throw together a quick sample for you if you want, and also, I have
an 'infinite progress' control that is styled after the Windows 2000 boot
screen - if you think this would help, just let me know.

Cheers,
Lubos


I would highly appreciate that. Do please.
Nov 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.