473,545 Members | 666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Sho wDialog()

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.Sho wDialog()
end sub

As usual, I appreciate your help...
Nov 20 '05 #1
7 5376
* Pepi Tonas <Pe*******@hotm ail.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.EventArg s) _
Handles Button1.Click

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

Public Delegate Sub ProgressDelegat e(ByVal Progress As Integer)

Private Sub OnProgress(ByVa l Progress As Integer)
If Me.InvokeRequir ed Then
Me.Invoke(New ProgressDelegat e( _
AddressOf OnProgress _
), New Object() {Progress})
Else
Me.Button1.Text = Progress.ToStri ng
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(AddressO f ThreadStart)
m_Thread.Start( )
End Sub

Private Sub ThreadStart()
Dim i As Integer
For i = 1 To 100
Thread.Sleep(10 0)
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.Sho wDialog()

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.Sho wDialog()
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*******@hotm ail.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.EventArg s) _
Handles Button1.Click

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

Public Delegate Sub ProgressDelegat e(ByVal Progress As Integer)

Private Sub OnProgress(ByVa l Progress As Integer)
If Me.InvokeRequir ed Then
Me.Invoke(Ne w ProgressDelegat e( _
AddressOf OnProgress _
), New Object() {Progress})
Else
Me.Button1.Tex t = Progress.ToStri ng
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(AddressO f ThreadStart)
m_Thread.Start ()
End Sub

Private Sub ThreadStart()
Dim i As Integer
For i = 1 To 100
Thread.Sleep(1 00)
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.Sho wDialog()

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.Sho wDialog()
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*******@hotm ail.com>
Newsgroups: microsoft.publi c.dotnet.langua ges.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.ph x.gbl!cpmsftngx a10.phx.gbl!TK2 MSFTNGXA05.phx. gbl!TK2MSFTNGP0 8
.phx.gbl!newsfe ed00.sul.t-online.de!newsf eed01.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.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:172335
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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.Sho wDialog()

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.Sho wDialog()
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******** ******@cpmsftng xa07.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*******@hotm ail.com>
Newsgroups: microsoft.publi c.dotnet.langua ges.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.ph x.gbl!cpmsftngx a10.phx.gbl!TK2 MSFTNGXA05.phx. gbl!TK2MSFTNGP0 8 phx.gbl!newsfee d00.sul.t-online.de!newsf eed01.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.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:172335
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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.Sho wDialog()

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.Sho wDialog()
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
346
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 just run through as this is just a prototype that i am developing. Just out of interest though is it possible to show the progress of the form load?
13
2160
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 (it is statistical questioning form for companies) and execution of this one cycle takes about twenty seconds.
4
3255
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 function. In the javascript create 2 funtion Call LoadData in the window onload event.
8
5183
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? thanks... Imports System Imports System.Drawing Imports System.Drawing.Drawing2D
9
3259
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 problem occurs when i try to show a progress bar. The screen freezes. I know i'm not the first one to ask about it. but i'm looking
1
4104
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 framework 1.1). The application implements a Progress Bar webcontrol, that pops up in a window, using the HttpHandler interface, on the event of a button...
5
10873
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 have a form that has a button. ( this form is a child form of a parent form ( main form ). Anway...in this child form I have a button, and if clicked...
10
4316
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 that you can't put an animated gif in there, it becomes static (I did find that out in year 10 at school, I should have known, but that's just me). I...
2
2176
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 update , I dont use a form unless i have two. This , creates either one of two problems. When i'm downloading asynchonously , the main thread exits!
0
7807
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7419
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7756
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5971
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5326
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3442
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1879
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
703
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.