473,386 Members | 1,710 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,386 software developers and data experts.

Help with threading...

Using VS 2003, .NET:
I developed a windows application that performs several actions based on an
input file. The application displays a progress bar as each action executes.
Based on new requirements, this application needs to be able to shell off
other processes and wait while in the mean time displaying a progress bar of
the process's. I am using the System.Disgnostics.Process class to "start"
and "waitForExit" of these processes... I thought the best way to show status
was to kick off a separate thread that increments a progress bar on my GUI
while the processes's hasExited value is false... unfortunately this is not
working well for me. As I step through the code, everything looks good until
line 11 below executes... after executing this line nothing happens and the
application just hangs. Being a novice to threads, I wasn't sure if my
application of thread was appropriate in this instance (regardless I wanted
to try and make it work as a learning exercise). So, Is my application of a
separate thread appropriate? Should it be implemented differently, etc? Any
idea why the application just hangs after line 11?

Thanks for your attention to this, Charles:
1 Public Class frmMain
2 '....snip...
3 Private oProcess As System.Diagnostics.Process
4 '....snip...
5 Friend WithEvents pgAction As System.Windows.Forms.ProgressBar
6 '....snip...
7 Public Sub New()
8 MyBase.New()
9 'This call is required by the Windows Form Designer.
10 InitializeComponent()
11 'Add any initialization after the InitializeComponent() call
13 Me.MyMain()
14 End Sub
15 '....snip...
16 Private Sub IncrementActionProgress()
17 While Not oProcess.HasExited 'HACK start with a the progress bar
moving up 2 steps / second
18 If Me.pgAction.Value = 100 Then Me.pgAction.Value = 0 'Keep
going till thread is aborted...
19 Me.pgAction.Increment(1) 'declaration not shown...
20 System.Threading.Thread.CurrentThread.Sleep(500)
21 End While
22 End Sub
23 '....snip...
24 Private Sub MyMain
25 oProcess = New System.Diagnostics.Process
26 Try
27 oProcess.StartInfo.FileName = Process
28 oProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
29 oProcess.Start()
30 Dim t As System.Threading.Thread
31 t = New System.Threading.Thread(AddressOf
Me.IncrementActionProgress)
32 t.Start()
33 oProcess.WaitForExit()
34 t.Abort()
35 Me.pgAction.Value = Me.pgAction.Maximum 'Ensure that
progress bar goes to max...
36 Catch ex As Exception
37 Msgbox "Error: " & Err.Message 'TODO handle error
gracefully...
38 End Try
39 End Sub
Apr 18 '06 #1
6 1873
Hi,

If you want to use a progressbar, than you need to know

The Start
The in advance measured time or totalsteps that will be involved
The steps.

You know only the Start so your program makes in my opinion not much sense.

Cor
"hz****@nopost.com" <hz*************@discussions.microsoft.com> schreef in
bericht news:E2**********************************@microsof t.com...
Using VS 2003, .NET:
I developed a windows application that performs several actions based on
an
input file. The application displays a progress bar as each action
executes.
Based on new requirements, this application needs to be able to shell off
other processes and wait while in the mean time displaying a progress bar
of
the process's. I am using the System.Disgnostics.Process class to "start"
and "waitForExit" of these processes... I thought the best way to show
status
was to kick off a separate thread that increments a progress bar on my GUI
while the processes's hasExited value is false... unfortunately this is
not
working well for me. As I step through the code, everything looks good
until
line 11 below executes... after executing this line nothing happens and
the
application just hangs. Being a novice to threads, I wasn't sure if my
application of thread was appropriate in this instance (regardless I
wanted
to try and make it work as a learning exercise). So, Is my application of
a
separate thread appropriate? Should it be implemented differently, etc?
Any
idea why the application just hangs after line 11?

Thanks for your attention to this, Charles:
1 Public Class frmMain
2 '....snip...
3 Private oProcess As System.Diagnostics.Process
4 '....snip...
5 Friend WithEvents pgAction As System.Windows.Forms.ProgressBar
6 '....snip...
7 Public Sub New()
8 MyBase.New()
9 'This call is required by the Windows Form Designer.
10 InitializeComponent()
11 'Add any initialization after the InitializeComponent() call
13 Me.MyMain()
14 End Sub
15 '....snip...
16 Private Sub IncrementActionProgress()
17 While Not oProcess.HasExited 'HACK start with a the progress
bar
moving up 2 steps / second
18 If Me.pgAction.Value = 100 Then Me.pgAction.Value = 0
'Keep
going till thread is aborted...
19 Me.pgAction.Increment(1) 'declaration not shown...
20 System.Threading.Thread.CurrentThread.Sleep(500)
21 End While
22 End Sub
23 '....snip...
24 Private Sub MyMain
25 oProcess = New System.Diagnostics.Process
26 Try
27 oProcess.StartInfo.FileName = Process
28 oProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
29 oProcess.Start()
30 Dim t As System.Threading.Thread
31 t = New System.Threading.Thread(AddressOf
Me.IncrementActionProgress)
32 t.Start()
33 oProcess.WaitForExit()
34 t.Abort()
35 Me.pgAction.Value = Me.pgAction.Maximum 'Ensure that
progress bar goes to max...
36 Catch ex As Exception
37 Msgbox "Error: " & Err.Message 'TODO handle error
gracefully...
38 End Try
39 End Sub

Apr 18 '06 #2
Hi Charles,

The problem is that a Windows Form is STA Threaded. Your threads are
multi-threaded. They cannot operate directly on the Form thread. Instead,
methods on the main thread have to be marshalled to it. There is a good
series of articles in the MSDN library about this. Read all 3 of them
carefully. It's not all that easy to grasp!

http://msdn.microsoft.com/library/de...ms06112002.asp
http://msdn.microsoft.com/library/de...ms08162002.asp
http://msdn.microsoft.com/library/de...ms08162002.asp

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote in
message news:E2**********************************@microsof t.com...
Using VS 2003, .NET:
I developed a windows application that performs several actions based on
an
input file. The application displays a progress bar as each action
executes.
Based on new requirements, this application needs to be able to shell off
other processes and wait while in the mean time displaying a progress bar
of
the process's. I am using the System.Disgnostics.Process class to "start"
and "waitForExit" of these processes... I thought the best way to show
status
was to kick off a separate thread that increments a progress bar on my GUI
while the processes's hasExited value is false... unfortunately this is
not
working well for me. As I step through the code, everything looks good
until
line 11 below executes... after executing this line nothing happens and
the
application just hangs. Being a novice to threads, I wasn't sure if my
application of thread was appropriate in this instance (regardless I
wanted
to try and make it work as a learning exercise). So, Is my application of
a
separate thread appropriate? Should it be implemented differently, etc?
Any
idea why the application just hangs after line 11?

Thanks for your attention to this, Charles:
1 Public Class frmMain
2 '....snip...
3 Private oProcess As System.Diagnostics.Process
4 '....snip...
5 Friend WithEvents pgAction As System.Windows.Forms.ProgressBar
6 '....snip...
7 Public Sub New()
8 MyBase.New()
9 'This call is required by the Windows Form Designer.
10 InitializeComponent()
11 'Add any initialization after the InitializeComponent() call
13 Me.MyMain()
14 End Sub
15 '....snip...
16 Private Sub IncrementActionProgress()
17 While Not oProcess.HasExited 'HACK start with a the progress
bar
moving up 2 steps / second
18 If Me.pgAction.Value = 100 Then Me.pgAction.Value = 0
'Keep
going till thread is aborted...
19 Me.pgAction.Increment(1) 'declaration not shown...
20 System.Threading.Thread.CurrentThread.Sleep(500)
21 End While
22 End Sub
23 '....snip...
24 Private Sub MyMain
25 oProcess = New System.Diagnostics.Process
26 Try
27 oProcess.StartInfo.FileName = Process
28 oProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
29 oProcess.Start()
30 Dim t As System.Threading.Thread
31 t = New System.Threading.Thread(AddressOf
Me.IncrementActionProgress)
32 t.Start()
33 oProcess.WaitForExit()
34 t.Abort()
35 Me.pgAction.Value = Me.pgAction.Maximum 'Ensure that
progress bar goes to max...
36 Catch ex As Exception
37 Msgbox "Error: " & Err.Message 'TODO handle error
gracefully...
38 End Try
39 End Sub

Apr 18 '06 #3
Actually, I do know how many steps (totalsteps) and the expected duration of
the processes to be shelled... the code below was me just trying to see if I
could get it to work...

"Cor Ligthert [MVP]" wrote:
Hi,

If you want to use a progressbar, than you need to know

The Start
The in advance measured time or totalsteps that will be involved
The steps.

You know only the Start so your program makes in my opinion not much sense.

Cor
"hz****@nopost.com" <hz*************@discussions.microsoft.com> schreef in
bericht news:E2**********************************@microsof t.com...
Using VS 2003, .NET:
I developed a windows application that performs several actions based on
an
input file. The application displays a progress bar as each action
executes.
Based on new requirements, this application needs to be able to shell off
other processes and wait while in the mean time displaying a progress bar
of
the process's. I am using the System.Disgnostics.Process class to "start"
and "waitForExit" of these processes... I thought the best way to show
status
was to kick off a separate thread that increments a progress bar on my GUI
while the processes's hasExited value is false... unfortunately this is
not
working well for me. As I step through the code, everything looks good
until
line 11 below executes... after executing this line nothing happens and
the
application just hangs. Being a novice to threads, I wasn't sure if my
application of thread was appropriate in this instance (regardless I
wanted
to try and make it work as a learning exercise). So, Is my application of
a
separate thread appropriate? Should it be implemented differently, etc?
Any
idea why the application just hangs after line 11?

Thanks for your attention to this, Charles:
1 Public Class frmMain
2 '....snip...
3 Private oProcess As System.Diagnostics.Process
4 '....snip...
5 Friend WithEvents pgAction As System.Windows.Forms.ProgressBar
6 '....snip...
7 Public Sub New()
8 MyBase.New()
9 'This call is required by the Windows Form Designer.
10 InitializeComponent()
11 'Add any initialization after the InitializeComponent() call
13 Me.MyMain()
14 End Sub
15 '....snip...
16 Private Sub IncrementActionProgress()
17 While Not oProcess.HasExited 'HACK start with a the progress
bar
moving up 2 steps / second
18 If Me.pgAction.Value = 100 Then Me.pgAction.Value = 0
'Keep
going till thread is aborted...
19 Me.pgAction.Increment(1) 'declaration not shown...
20 System.Threading.Thread.CurrentThread.Sleep(500)
21 End While
22 End Sub
23 '....snip...
24 Private Sub MyMain
25 oProcess = New System.Diagnostics.Process
26 Try
27 oProcess.StartInfo.FileName = Process
28 oProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
29 oProcess.Start()
30 Dim t As System.Threading.Thread
31 t = New System.Threading.Thread(AddressOf
Me.IncrementActionProgress)
32 t.Start()
33 oProcess.WaitForExit()
34 t.Abort()
35 Me.pgAction.Value = Me.pgAction.Maximum 'Ensure that
progress bar goes to max...
36 Catch ex As Exception
37 Msgbox "Error: " & Err.Message 'TODO handle error
gracefully...
38 End Try
39 End Sub


Apr 18 '06 #4
Ok, I'll take a read... thanks for the reference.
If I have questions about those articles, I'll post them here.

"Kevin Spencer" wrote:
Hi Charles,

The problem is that a Windows Form is STA Threaded. Your threads are
multi-threaded. They cannot operate directly on the Form thread. Instead,
methods on the main thread have to be marshalled to it. There is a good
series of articles in the MSDN library about this. Read all 3 of them
carefully. It's not all that easy to grasp!

http://msdn.microsoft.com/library/de...ms06112002.asp
http://msdn.microsoft.com/library/de...ms08162002.asp
http://msdn.microsoft.com/library/de...ms08162002.asp

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote in
message news:E2**********************************@microsof t.com...
Using VS 2003, .NET:
I developed a windows application that performs several actions based on
an
input file. The application displays a progress bar as each action
executes.
Based on new requirements, this application needs to be able to shell off
other processes and wait while in the mean time displaying a progress bar
of
the process's. I am using the System.Disgnostics.Process class to "start"
and "waitForExit" of these processes... I thought the best way to show
status
was to kick off a separate thread that increments a progress bar on my GUI
while the processes's hasExited value is false... unfortunately this is
not
working well for me. As I step through the code, everything looks good
until
line 11 below executes... after executing this line nothing happens and
the
application just hangs. Being a novice to threads, I wasn't sure if my
application of thread was appropriate in this instance (regardless I
wanted
to try and make it work as a learning exercise). So, Is my application of
a
separate thread appropriate? Should it be implemented differently, etc?
Any
idea why the application just hangs after line 11?

Thanks for your attention to this, Charles:
1 Public Class frmMain
2 '....snip...
3 Private oProcess As System.Diagnostics.Process
4 '....snip...
5 Friend WithEvents pgAction As System.Windows.Forms.ProgressBar
6 '....snip...
7 Public Sub New()
8 MyBase.New()
9 'This call is required by the Windows Form Designer.
10 InitializeComponent()
11 'Add any initialization after the InitializeComponent() call
13 Me.MyMain()
14 End Sub
15 '....snip...
16 Private Sub IncrementActionProgress()
17 While Not oProcess.HasExited 'HACK start with a the progress
bar
moving up 2 steps / second
18 If Me.pgAction.Value = 100 Then Me.pgAction.Value = 0
'Keep
going till thread is aborted...
19 Me.pgAction.Increment(1) 'declaration not shown...
20 System.Threading.Thread.CurrentThread.Sleep(500)
21 End While
22 End Sub
23 '....snip...
24 Private Sub MyMain
25 oProcess = New System.Diagnostics.Process
26 Try
27 oProcess.StartInfo.FileName = Process
28 oProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
29 oProcess.Start()
30 Dim t As System.Threading.Thread
31 t = New System.Threading.Thread(AddressOf
Me.IncrementActionProgress)
32 t.Start()
33 oProcess.WaitForExit()
34 t.Abort()
35 Me.pgAction.Value = Me.pgAction.Maximum 'Ensure that
progress bar goes to max...
36 Catch ex As Exception
37 Msgbox "Error: " & Err.Message 'TODO handle error
gracefully...
38 End Try
39 End Sub


Apr 18 '06 #5
I read the above articles (second link is duplicated) and implemented some
changes in my code...(no more threading but async calls?) but my GUI still
does not get updated - actually, after the new process is started, my GUI
doesn't get painted again until after that process has completed - so it
appears that this is not working for me... is this because I'm doing all my
work in one class (frmMain)? Anyway, here's the code that I've got now. What
am I doing wrong here?

Public Class frmMain
'....snip...
Private oProcess As System.Diagnostics.Process
'....snip...
Friend WithEvents pgAction As System.Windows.Forms.ProgressBar
'....snip...
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
Me.MyMain() 'Process actions...
End Sub
'....snip...
Private Sub IncrementActionProgress()
If Me.pgAction.InvokeRequired Then
'Show progress asynchronously
Dim iapd As IncrementActionProgressDelegate = _
New IncrementActionProgressDelegate(AddressOf
IncrementActionProgress)
Me.BeginInvoke(iapd)
Else
If Me.pgAction.Value = 100 Then Me.pgAction.Value = 0
Me.pgAction.Value += 1
Me.Refresh()
System.Threading.Thread.Sleep(500)
End If
End Sub

Delegate Sub IncrementActionProgressDelegate()

Private Sub MyMain()
oProcess = New System.Diagnostics.Process
Try
oProcess.StartInfo.FileName = Process
Me.pgAction.Value = 0
oProcess.Start()
While Not oProcess.HasExited
Me.IncrementActionProgress()
End While
oProcess.WaitForExit() 'Yes, this is redundant...
Me.pgAction.Value = Me.pgAction.Maximum
Catch ex As Exception
'TODO Handle error gracefully
End Try
End Sub
'....snip...
End Class

"Kevin Spencer" wrote:
Hi Charles,

The problem is that a Windows Form is STA Threaded. Your threads are
multi-threaded. They cannot operate directly on the Form thread. Instead,
methods on the main thread have to be marshalled to it. There is a good
series of articles in the MSDN library about this. Read all 3 of them
carefully. It's not all that easy to grasp!

http://msdn.microsoft.com/library/de...ms06112002.asp
http://msdn.microsoft.com/library/de...ms08162002.asp
http://msdn.microsoft.com/library/de...ms08162002.asp

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote in
message news:E2**********************************@microsof t.com...
Using VS 2003, .NET:
I developed a windows application that performs several actions based on
an
input file. The application displays a progress bar as each action
executes.
Based on new requirements, this application needs to be able to shell off
other processes and wait while in the mean time displaying a progress bar
of
the process's. I am using the System.Disgnostics.Process class to "start"
and "waitForExit" of these processes... I thought the best way to show
status
was to kick off a separate thread that increments a progress bar on my GUI
while the processes's hasExited value is false... unfortunately this is
not
working well for me. As I step through the code, everything looks good
until
line 11 below executes... after executing this line nothing happens and
the
application just hangs. Being a novice to threads, I wasn't sure if my
application of thread was appropriate in this instance (regardless I
wanted
to try and make it work as a learning exercise). So, Is my application of
a
separate thread appropriate? Should it be implemented differently, etc?
Any
idea why the application just hangs after line 11?

Thanks for your attention to this, Charles:
1 Public Class frmMain
2 '....snip...
3 Private oProcess As System.Diagnostics.Process
4 '....snip...
5 Friend WithEvents pgAction As System.Windows.Forms.ProgressBar
6 '....snip...
7 Public Sub New()
8 MyBase.New()
9 'This call is required by the Windows Form Designer.
10 InitializeComponent()
11 'Add any initialization after the InitializeComponent() call
13 Me.MyMain()
14 End Sub
15 '....snip...
16 Private Sub IncrementActionProgress()
17 While Not oProcess.HasExited 'HACK start with a the progress
bar
moving up 2 steps / second
18 If Me.pgAction.Value = 100 Then Me.pgAction.Value = 0
'Keep
going till thread is aborted...
19 Me.pgAction.Increment(1) 'declaration not shown...
20 System.Threading.Thread.CurrentThread.Sleep(500)
21 End While
22 End Sub
23 '....snip...
24 Private Sub MyMain
25 oProcess = New System.Diagnostics.Process
26 Try
27 oProcess.StartInfo.FileName = Process
28 oProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
29 oProcess.Start()
30 Dim t As System.Threading.Thread
31 t = New System.Threading.Thread(AddressOf
Me.IncrementActionProgress)
32 t.Start()
33 oProcess.WaitForExit()
34 t.Abort()
35 Me.pgAction.Value = Me.pgAction.Maximum 'Ensure that
progress bar goes to max...
36 Catch ex As Exception
37 Msgbox "Error: " & Err.Message 'TODO handle error
gracefully...
38 End Try
39 End Sub


Apr 18 '06 #6
I do most of my programming in C#, but I'm sure there is a call in
vb.net that coorisponds to the this.Update() or even this.Refresh()
function at form level.

I use this to update my forms when I need it to post info back to the
form before it finishes executing and repaints the form.
hz****@nopost.com wrote:
I read the above articles (second link is duplicated) and implemented some
changes in my code...(no more threading but async calls?) but my GUI still
does not get updated - actually, after the new process is started, my GUI
doesn't get painted again until after that process has completed - so it
appears that this is not working for me... is this because I'm doing all my
work in one class (frmMain)? Anyway, here's the code that I've got now. What
am I doing wrong here?

Public Class frmMain
'....snip...
Private oProcess As System.Diagnostics.Process
'....snip...
Friend WithEvents pgAction As System.Windows.Forms.ProgressBar
'....snip...
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
Me.MyMain() 'Process actions...
End Sub
'....snip...
Private Sub IncrementActionProgress()
If Me.pgAction.InvokeRequired Then
'Show progress asynchronously
Dim iapd As IncrementActionProgressDelegate = _
New IncrementActionProgressDelegate(AddressOf
IncrementActionProgress)
Me.BeginInvoke(iapd)
Else
If Me.pgAction.Value = 100 Then Me.pgAction.Value = 0
Me.pgAction.Value += 1
Me.Refresh()
System.Threading.Thread.Sleep(500)
End If
End Sub

Delegate Sub IncrementActionProgressDelegate()

Private Sub MyMain()
oProcess = New System.Diagnostics.Process
Try
oProcess.StartInfo.FileName = Process
Me.pgAction.Value = 0
oProcess.Start()
While Not oProcess.HasExited
Me.IncrementActionProgress()
End While
oProcess.WaitForExit() 'Yes, this is redundant...
Me.pgAction.Value = Me.pgAction.Maximum
Catch ex As Exception
'TODO Handle error gracefully
End Try
End Sub
'....snip...
End Class

"Kevin Spencer" wrote:
Hi Charles,

The problem is that a Windows Form is STA Threaded. Your threads are
multi-threaded. They cannot operate directly on the Form thread. Instead,
methods on the main thread have to be marshalled to it. There is a good
series of articles in the MSDN library about this. Read all 3 of them
carefully. It's not all that easy to grasp!

http://msdn.microsoft.com/library/de...ms06112002.asp
http://msdn.microsoft.com/library/de...ms08162002.asp
http://msdn.microsoft.com/library/de...ms08162002.asp

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote in
message news:E2**********************************@microsof t.com...
Using VS 2003, .NET:
I developed a windows application that performs several actions based on
an
input file. The application displays a progress bar as each action
executes.
Based on new requirements, this application needs to be able to shell off
other processes and wait while in the mean time displaying a progress bar
of
the process's. I am using the System.Disgnostics.Process class to "start"
and "waitForExit" of these processes... I thought the best way to show
status
was to kick off a separate thread that increments a progress bar on my GUI
while the processes's hasExited value is false... unfortunately this is
not
working well for me. As I step through the code, everything looks good
until
line 11 below executes... after executing this line nothing happens and
the
application just hangs. Being a novice to threads, I wasn't sure if my
application of thread was appropriate in this instance (regardless I
wanted
to try and make it work as a learning exercise). So, Is my application of
a
separate thread appropriate? Should it be implemented differently, etc?
Any
idea why the application just hangs after line 11?

Thanks for your attention to this, Charles:
1 Public Class frmMain
2 '....snip...
3 Private oProcess As System.Diagnostics.Process
4 '....snip...
5 Friend WithEvents pgAction As System.Windows.Forms.ProgressBar
6 '....snip...
7 Public Sub New()
8 MyBase.New()
9 'This call is required by the Windows Form Designer.
10 InitializeComponent()
11 'Add any initialization after the InitializeComponent() call
13 Me.MyMain()
14 End Sub
15 '....snip...
16 Private Sub IncrementActionProgress()
17 While Not oProcess.HasExited 'HACK start with a the progress
bar
moving up 2 steps / second
18 If Me.pgAction.Value = 100 Then Me.pgAction.Value = 0
'Keep
going till thread is aborted...
19 Me.pgAction.Increment(1) 'declaration not shown...
20 System.Threading.Thread.CurrentThread.Sleep(500)
21 End While
22 End Sub
23 '....snip...
24 Private Sub MyMain
25 oProcess = New System.Diagnostics.Process
26 Try
27 oProcess.StartInfo.FileName = Process
28 oProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
29 oProcess.Start()
30 Dim t As System.Threading.Thread
31 t = New System.Threading.Thread(AddressOf
Me.IncrementActionProgress)
32 t.Start()
33 oProcess.WaitForExit()
34 t.Abort()
35 Me.pgAction.Value = Me.pgAction.Maximum 'Ensure that
progress bar goes to max...
36 Catch ex As Exception
37 Msgbox "Error: " & Err.Message 'TODO handle error
gracefully...
38 End Try
39 End Sub



Apr 28 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Egor Bolonev | last post by:
hi all my program terminates with error i dont know why it tells 'TypeError: run() takes exactly 1 argument (10 given)' =program==================== import os, os.path, threading, sys def...
1
by: Ognjen Bezanov | last post by:
Hi, all Thanks all of you who helped me with the threading and queues issue. I am trying to get it working but I am having problems. When I try to run the following: cmddata =...
0
by: Maxwell Hammer | last post by:
Hope someone can help with a problem I'm having. A python program I wrote terminates with the following traceback. *** start traceback *** Error in atexit._run_exitfuncs: Traceback (most recent...
2
by: hnkien | last post by:
Hi, I am writing a windows service with threading.timer for 10 seconds but it didn't work. Here are my code: namespace SchedulerService { public class ScheduleService :...
22
by: Jeff Louie | last post by:
Well I wonder if my old brain can handle threading. Dose this code look reasonable. Regards, Jeff using System; using System.Diagnostics; using System.IO; using System.Threading;
10
by: MikeScullion | last post by:
I have set up this thread so my program doesn't hang while I call a cpu intensive bit of code: System.Threading.ThreadStart ThreadEncoderStart = new...
5
by: Sinan Nalkaya | last post by:
hello, i need a function like that, wait 5 seconds: (during wait) do the function but function waits for keyboard input so if you dont enter any it waits forever. i tried time.sleep() but when...
15
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to...
3
by: dedalusenator | last post by:
Hello Folks, My first posting here and I am a stuck in figuring out the exact way to update a global variable from within a function that doesnt return any value (because the function is a...
1
by: JoeSox | last post by:
I have two threads going class guiThread(threading.Thread) class mainThread(threading.Thread) Within the guiThread, I have an instance of class GUIFramework(Frame) in this Tkinter instance I...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.