473,403 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Progress Form

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
7 5360
* 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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: angelina | last post by:
Hi, Can anyone help me write some code that will run a progress bar before a new form is loaded? The progressbar does not have to represent the actual progress of the form load but simply...
13
by: Martin Mrazek | last post by:
Hi, I check data validity in html form by JS. Something like for (i=0; i<document.form.elements.length; i++) { chechkValidity(i); } Unfortunately, the form has about two thousands elements...
4
by: aj | last post by:
Alan, you can achieve this by using XMLHttp Async functionality in a javascript file. Create an aspx page in which execute long running SQL query, then do an XMLhttp post to that page from a js...
8
by: Brian Henry | last post by:
I created a smooth progress bar with this code.. but if you update the values in a row quickly of it and watch it on screen it flickers... how would i change this to reduce the flickering?...
9
by: esakal | last post by:
Hello, I'm programming an application based on CAB infrastructure in the client side (c# .net 2005) Since my application must be sequencally, i wrote all the code in the UI thread. my...
1
by: daniel_xi | last post by:
Hi all, I am running a VS 2003 .NET project on my client machine (Win 2000 SP4, ..NET framework 1.1), running an ASP.NET application on a remote web server (Win 2000 Server, IIS 6.0, .NET...
5
by: Miro | last post by:
I will try my best to ask this question correctly. I think in the end the code will make more sence of what I am trying to accomplish. I am just not sure of what to search for on the net. I...
10
by: Robertf987 | last post by:
Okay, now then. I'm hoping somebody can help here, pretty please. I want to make a progress bar/indicator on a form. At first I was just going to insert an animated gif, but I've tried and remembered...
2
by: giddy | last post by:
hi , I'm in a slight dilemma. I have an updater program that checks for pending updates and downloads them if the users chooses to. Since i dont need a windows form to check if there is an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.