Showing posts with label task. Show all posts
Showing posts with label task. Show all posts

Thursday, March 22, 2012

Thought this would be simple

Thought I would work on setting certain UI elements dynamically. Sounded like an easy task until now. Any ideas how to resolve this error?

The ASPX page:

<%@dotnet.itags.org. Page Language="vb" AutoEventWireup="false" Codebehind="DynamicallyBuildTables.aspx.vb" Inherits="BookChp5a.DynamicallyBuildTables"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>DynamicallyBuildTables</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<P>
Rows:
<asp:TextBox id="txtRows" runat="server" /> Cols:
<asp:TextBox id="txtCols" runat="server" /></P>
<P>
<asp:CheckBox id="chkBorder" runat="server" Text="Put border around Cells"></asp:CheckBox></P>
<P>
<asp:DropDownList id="ddl1" runat="server"></asp:DropDownList>
</P>
<P>
<asp:Button id="cmdCreate" runat="server" Text="Create"></asp:Button><BR>
</P>
<P>
<asp:Table id="Tbl1" runat="server">
<asp:TableRow ID="row" Runat="server">
<asp:TableCell id="cell" Runat="server" Text="A Test RowSpan">
<!-- Instead of using the Text property, you could add other
ASP.NET control tags here. --></asp:TableCell>
</asp:TableRow>
</asp:Table>
</P>
</form>
</body>
</HTML>


The code behind file:

Public Class DynamicallyBuildTables
Inherits System.Web.UI.Page
' Inherits System.Web.UI.WebControls
#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub
Protected WithEvents txtRows As System.Web.UI.WebControls.TextBox
Protected WithEvents txtCols As System.Web.UI.WebControls.TextBox
Protected WithEvents chkBorder As System.Web.UI.WebControls.CheckBox
Protected WithEvents cmdCreate As System.Web.UI.WebControls.Button
Protected WithEvents Tbl1 As System.Web.UI.WebControls.Table
Protected WithEvents ddl1 As System.Web.UI.WebControls.DropDownList

'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If IsPostBack = False Then
Tbl1.Visible = False
ddl1.Items.Add("Dashed")
ddl1.Items.Add("Dotted")
ddl1.Items.Add("Doubled")
ddl1.Items.Add("Groove")
ddl1.Items.Add("Inset")
ddl1.Items.Add("None")
ddl1.Items.Add("NotSet")
ddl1.Items.Add("Outset")
ddl1.Items.Add("Ridge")
ddl1.Items.Add("Solid")
Else
Tbl1.Visible = True
End If
' Tbl1.BorderStyle = BorderStyle.Inset
Tbl1.BorderWidth = Unit.Pixel(1)
End Sub

Private Sub cmdCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCreate.Click
'Remove all current rows and cells.
'This would not be necessary if you set
'EnableViewState = False.
Tbl1.Controls.Clear()
Dim strRows As String = txtRows.Text
Dim strCols As String = txtCols.Text
Dim strBorder As String = "BorderStyle." & ddl1.SelectedItem.Text
Dim i, j As Integer
For i = 1 To Val(strRows)
'Create a new tablerow object.
Dim rowNew As New TableRow
'put the new tablerow into the table object.
Tbl1.Controls.Add(rowNew)
For j = 1 To Val(strCols)
'Create a new TableCell object.
Dim cellNew As New TableCell
'***************************** standard text
'cellNew.Text = "Example Cell (" & i.ToString() & ","
'cellNew.Text &= j.ToString() & ")<br />"
'*****************************
'***************************** Added as objects
Dim lblNew As New Label
Dim imgNew As New System.Web.UI.WebControls.Image
imgNew.ImageUrl = "/images/smile.gif"
lblNew.Text = "hello"
cellNew.Controls.Add(lblNew)
cellNew.Controls.Add(imgNew)
'*****************************

If chkBorder.Checked Then
' Not working accurately, but dows show how to
' dynamically set border style.
txtCols.Text = strBorder
cellNew.BorderStyle = strBorder 'Bombs right here
cellNew.BorderWidth = Unit.Pixel(4)
End If
'Put the TableCell in the TableRow.
rowNew.Controls.Add(cellNew)
Next
Next
End Sub
End Class


Also, Is there a way to populate the ddl1.items.add("") list within the code and not hard coding?Also, Is there a way to populate the ddl1.items.add("") list within the code and not hard coding?

I'm not sure what you're trying to do.
I'm not sure what you're trying to do.

Would help if I explained it more. Sorry about that. :blush:

I am trying to dynamicaly assign the BorderStyle from the value in a string variable. The following line blows up:

cellNew.BorderStyle = strBorder 'Bombs right here

In addition to that, when you manually assign "BorderStyle." intellisense pops up with the listed values:

Dashed
Dotted
Doubled
Groove
Inset
None
NotSet
Outset
Ridge
Solid

I want to capture those values and place them into a DropDownList with out having to hard code. Instead of doing it like this:

ddl1.Items.Add("Dashed")

Can I code it to auto populate those values?

Any ideas?

Thread object vs Threadpool?

Hi all!
In my webb app I'm about to introduce a way of processing long running tasks
in the background.
As the long running task gathers data from a database process them and
compile them into a file appx 80 mbytes large it is a resource demanding
task both of the CPU and the memory.
So I think I should restrict how many of these tasks that should be able to
start and make them run in the background.
First I read about the Thread class and thougth: Fine I'll use a thread and
then I'll write a utility class that will queue the tasks and make them run
either one after one or not too many at a time.
I'd set threads' priority to belowNormal or lowest.
Then I discovered the threadpool class and thought: Hey here's the queuing
abillity I was looking for. But then I found no way of setting the priority
of the thread that would start the long running task and I don't want to
make the web pages serve slowly.
Does anyone have any advice on whether I should use the threadpool or create
thread objects "on my own" in the code?
Thanks in advance!
mortbThreadPool class is mostly used for fire and forget tasks.
Use Thread class if extended control is needed.
-
Milosz Skalecki
MCP, MCAD
"mortb" wrote:

> Hi all!
> In my webb app I'm about to introduce a way of processing long running tas
ks
> in the background.
> As the long running task gathers data from a database process them and
> compile them into a file appx 80 mbytes large it is a resource demanding
> task both of the CPU and the memory.
> So I think I should restrict how many of these tasks that should be able t
o
> start and make them run in the background.
> First I read about the Thread class and thougth: Fine I'll use a thread an
d
> then I'll write a utility class that will queue the tasks and make them ru
n
> either one after one or not too many at a time.
> I'd set threads' priority to belowNormal or lowest.
> Then I discovered the threadpool class and thought: Hey here's the queuing
> abillity I was looking for. But then I found no way of setting the priorit
y
> of the thread that would start the long running task and I don't want to
> make the web pages serve slowly.
> Does anyone have any advice on whether I should use the threadpool or crea
te
> thread objects "on my own" in the code?
> Thanks in advance!
> mortb
>
>

Tuesday, March 13, 2012

Thread object vs Threadpool?

Hi all!

In my webb app I'm about to introduce a way of processing long running tasks
in the background.
As the long running task gathers data from a database process them and
compile them into a file appx 80 mbytes large it is a resource demanding
task both of the CPU and the memory.
So I think I should restrict how many of these tasks that should be able to
start and make them run in the background.

First I read about the Thread class and thougth: Fine I'll use a thread and
then I'll write a utility class that will queue the tasks and make them run
either one after one or not too many at a time.
I'd set threads' priority to belowNormal or lowest.

Then I discovered the threadpool class and thought: Hey here's the queuing
abillity I was looking for. But then I found no way of setting the priority
of the thread that would start the long running task and I don't want to
make the web pages serve slowly.

Does anyone have any advice on whether I should use the threadpool or create
thread objects "on my own" in the code?

Thanks in advance!
mortbThreadPool class is mostly used for fire and forget tasks.
Use Thread class if extended control is needed.
-
Milosz Skalecki
MCP, MCAD

"mortb" wrote:

> Hi all!
> In my webb app I'm about to introduce a way of processing long running tasks
> in the background.
> As the long running task gathers data from a database process them and
> compile them into a file appx 80 mbytes large it is a resource demanding
> task both of the CPU and the memory.
> So I think I should restrict how many of these tasks that should be able to
> start and make them run in the background.
> First I read about the Thread class and thougth: Fine I'll use a thread and
> then I'll write a utility class that will queue the tasks and make them run
> either one after one or not too many at a time.
> I'd set threads' priority to belowNormal or lowest.
> Then I discovered the threadpool class and thought: Hey here's the queuing
> abillity I was looking for. But then I found no way of setting the priority
> of the thread that would start the long running task and I don't want to
> make the web pages serve slowly.
> Does anyone have any advice on whether I should use the threadpool or create
> thread objects "on my own" in the code?
> Thanks in advance!
> mortb
>

Thread timeout

Hi,
I have a long running task that I want to run on a regular basis to do some
db updates. I can't write a windows service because it is being hosted
elsewhere. I want to run this task within my web application - so here is
what I did:
In the global.asax I declared a delegate function and a timer. In the
application start event, I started the timer. I created a method to
respond to the timer event, which creates a new thread and runs the Long
Running Task method:
Private Delegate Function LongRunningTaskTask() As Integer
Private WithEvents ServiceTimer As New System.Timers.Timer(86400000)
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
ServiceTimer.Start()
End Sub
Private Sub WakeUp(ByVal sender As Object, _
ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
Try
' Create new thread
Dim AsyncStatePrice As IAsyncResult
' Start the task on a runtime thread asynchronously
Dim AsyncInvokerPrice As New LongRunningTaskTask(AddressOf
LongRunningTaskUpdate)
AsyncStatePrice = AsyncInvokerPrice.BeginInvoke(Nothing,
Nothing)
Dim WaitHandles() As WaitHandle =
{AsyncStatePrice.AsyncWaitHandle}
WaitHandle.WaitAll(WaitHandles)
Catch ex As Exception
'Throw (ex)
End Try
End Sub
The method kicks off fine, but times-out before completion. I want this to
continue running regardless if the person who invoked the application start
event has their browser open or not. Is there a way to increase the
timeout value for the thread through code. I don't want to change the
session timeout for everyone, just this one process. Is there a better
solution?
Thanks
Message posted via http://www.webservertalk.comIt seems you have a long running task, but I don't see where the return
value comes into play.
This might not be the best solution for what you want, but it is something
else to consider. You could use the ThreadPool.QueueUserWorkItem method
that takes a WaitCallBack and an optional object parameter.
ApplicationStart
ThreadPool.QueueUserWorkItem( new WaitCallBack( LongRunningTask ) );
public static void LongRunningTask( object data )
{
//your long running task in here. If you need the user who kicked this off,
you can pass it
//through object data.
}
LongRunningTask will run in a thread from the ThreadPool that .NET
maintains. The timer event also runs from the thread pool. However, this
is a one time, queue this method and run it. It does not have to be a
static (shared) method, but mine typically are. If you need to do something
with the return value, I am sure you could come up with something, or not
even take this approach anyway.
Timers typically are used for recurring tasks, like checking application
state, processing a continuous queue. If you are merely running this task
"on occasion", it probably would be better served using the thread pool.
I just looked and you code is in VB, sorry about my samples.
HTH,
bill
"JeffSinNHUSA via webservertalk.com" <forum@.webservertalk.com> wrote in
message news:85011c9724d646de9be3606d4c960ba2@.Do
webservertalk.com...
> Hi,
> I have a long running task that I want to run on a regular basis to do
some
> db updates. I can't write a windows service because it is being hosted
> elsewhere. I want to run this task within my web application - so here is
> what I did:
> In the global.asax I declared a delegate function and a timer. In the
> application start event, I started the timer. I created a method to
> respond to the timer event, which creates a new thread and runs the Long
> Running Task method:
> Private Delegate Function LongRunningTaskTask() As Integer
> Private WithEvents ServiceTimer As New System.Timers.Timer(86400000)
>
> Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
> ServiceTimer.Start()
> End Sub
>
> Private Sub WakeUp(ByVal sender As Object, _
> ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
> Try
> ' Create new thread
> Dim AsyncStatePrice As IAsyncResult
> ' Start the task on a runtime thread asynchronously
> Dim AsyncInvokerPrice As New LongRunningTaskTask(AddressOf
> LongRunningTaskUpdate)
> AsyncStatePrice = AsyncInvokerPrice.BeginInvoke(Nothing,
> Nothing)
> Dim WaitHandles() As WaitHandle =
> {AsyncStatePrice.AsyncWaitHandle}
> WaitHandle.WaitAll(WaitHandles)
> Catch ex As Exception
> 'Throw (ex)
> End Try
> End Sub
>
> The method kicks off fine, but times-out before completion. I want this
to
> continue running regardless if the person who invoked the application
start
> event has their browser open or not. Is there a way to increase the
> timeout value for the thread through code. I don't want to change the
> session timeout for everyone, just this one process. Is there a better
> solution?
> Thanks
> --
> Message posted via http://www.webservertalk.com
Well, I tried the ThreadPool.QueueUserWorkItem approach, but it looks like
it terminates the thread after about 30 seconds.
Private WithEvents ServiceTimer As New System.Timers.Timer(600000)
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
ServiceTimer.Start()
End Sub
Private Sub PricePointsWakeUp(ByVal sender As Object, _
ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
Dim stateInfo As New TaskInfo("Price Points Update", 1)
If ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf
LongRunningTask), stateInfo) Then
Thread.Sleep(1000)
End If
End Sub
Public Class TaskInfo
Public Boilerplate As String
Public Value As Integer
Public Sub New(ByVal text As String, ByVal number As Integer)
Boilerplate = text
Value = number
End Sub
End Class
Shared Sub LongRunningTask(ByVal stateInfo As Object)
End Sub
Message posted via http://www.webservertalk.com
I did not realize you are wanting to fire your price point method every
600000. I thought you were wanting a queue that you could queue up long
running tasks, and use your timer to clear the queue. You can probably skip
the queue user work item since your timer is called from a thread in the
ThreadPool anyway. My mistake.
How do you know the thread is dying? Is it receiving a
ThreadAbortException. (that means the thread is timing out) or it is a Sql
timeout exception. If a Sql Timeout exception, you could increase the
CommandTimeout on your SqlCommand object.
If you are recieving the ThreadAbortException, you probably will have to
manually create a thread (not from the ThreadPool) to run the long running
task. Your timer shouldn't block waiting for it to complete, but probably
should fire the thread off and then return immediately.
If you need a sample to get a manually created thread off and running let me
know.
Sorry for misunderstanding you and basically giving you the run around. :)
bill
"JeffSinNHUSA via webservertalk.com" <forum@.webservertalk.com> wrote in
message news:4f599a23f948417db07f21a9143b623c@.Do
webservertalk.com...
> Well, I tried the ThreadPool.QueueUserWorkItem approach, but it looks
like
> it terminates the thread after about 30 seconds.
>
> Private WithEvents ServiceTimer As New System.Timers.Timer(600000)
> Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
> ServiceTimer.Start()
> End Sub
>
> Private Sub PricePointsWakeUp(ByVal sender As Object, _
> ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
> Dim stateInfo As New TaskInfo("Price Points Update", 1)
> If ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf
> LongRunningTask), stateInfo) Then
> Thread.Sleep(1000)
> End If
> End Sub
> Public Class TaskInfo
> Public Boilerplate As String
> Public Value As Integer
> Public Sub New(ByVal text As String, ByVal number As Integer)
> Boilerplate = text
> Value = number
> End Sub
> End Class
> Shared Sub LongRunningTask(ByVal stateInfo As Object)
> End Sub
> --
> Message posted via http://www.webservertalk.com
No problem on the advice - I learned something new.
So back to the old code. I threw try catch blocks around everything, and
instead of throwing an exception, I emailed myself the esception info. I
also email myself as it loops thru the data it is processing. After about
6 iterations (which takes about 60 seconds) I stop receiving emails. Looks
like an exception isn't being thrown.
Message posted via http://www.webservertalk.com

Thread timeout

Hi,

I have a long running task that I want to run on a regular basis to do some
db updates. I can't write a windows service because it is being hosted
elsewhere. I want to run this task within my web application - so here is
what I did:

In the global.asax I declared a delegate function and a timer. In the
application start event, I started the timer. I created a method to
respond to the timer event, which creates a new thread and runs the Long
Running Task method:

Private Delegate Function LongRunningTaskTask() As Integer
Private WithEvents ServiceTimer As New System.Timers.Timer(86400000)

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
ServiceTimer.Start()
End Sub

Private Sub WakeUp(ByVal sender As Object, _
ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
Try
' Create new thread
Dim AsyncStatePrice As IAsyncResult
' Start the task on a runtime thread asynchronously
Dim AsyncInvokerPrice As New LongRunningTaskTask(AddressOf
LongRunningTaskUpdate)

AsyncStatePrice = AsyncInvokerPrice.BeginInvoke(Nothing,
Nothing)

Dim WaitHandles() As WaitHandle =
{AsyncStatePrice.AsyncWaitHandle}
WaitHandle.WaitAll(WaitHandles)

Catch ex As Exception
'Throw (ex)
End Try
End Sub

The method kicks off fine, but times-out before completion. I want this to
continue running regardless if the person who invoked the application start
event has their browser open or not. Is there a way to increase the
timeout value for the thread through code. I don't want to change the
session timeout for everyone, just this one process. Is there a better
solution?

Thanks

--
Message posted via http://www.dotnetmonster.comIt seems you have a long running task, but I don't see where the return
value comes into play.

This might not be the best solution for what you want, but it is something
else to consider. You could use the ThreadPool.QueueUserWorkItem method
that takes a WaitCallBack and an optional object parameter.

ApplicationStart

ThreadPool.QueueUserWorkItem( new WaitCallBack( LongRunningTask ) );

public static void LongRunningTask( object data )
{
//your long running task in here. If you need the user who kicked this off,
you can pass it
//through object data.
}

LongRunningTask will run in a thread from the ThreadPool that .NET
maintains. The timer event also runs from the thread pool. However, this
is a one time, queue this method and run it. It does not have to be a
static (shared) method, but mine typically are. If you need to do something
with the return value, I am sure you could come up with something, or not
even take this approach anyway.

Timers typically are used for recurring tasks, like checking application
state, processing a continuous queue. If you are merely running this task
"on occasion", it probably would be better served using the thread pool.

I just looked and you code is in VB, sorry about my samples.

HTH,

bill

"JeffSinNHUSA via DotNetMonster.com" <forum@.DotNetMonster.com> wrote in
message news:85011c9724d646de9be3606d4c960ba2@.DotNetMonste r.com...
> Hi,
> I have a long running task that I want to run on a regular basis to do
some
> db updates. I can't write a windows service because it is being hosted
> elsewhere. I want to run this task within my web application - so here is
> what I did:
> In the global.asax I declared a delegate function and a timer. In the
> application start event, I started the timer. I created a method to
> respond to the timer event, which creates a new thread and runs the Long
> Running Task method:
> Private Delegate Function LongRunningTaskTask() As Integer
> Private WithEvents ServiceTimer As New System.Timers.Timer(86400000)
>
> Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
> ServiceTimer.Start()
> End Sub
>
> Private Sub WakeUp(ByVal sender As Object, _
> ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
> Try
> ' Create new thread
> Dim AsyncStatePrice As IAsyncResult
> ' Start the task on a runtime thread asynchronously
> Dim AsyncInvokerPrice As New LongRunningTaskTask(AddressOf
> LongRunningTaskUpdate)
> AsyncStatePrice = AsyncInvokerPrice.BeginInvoke(Nothing,
> Nothing)
> Dim WaitHandles() As WaitHandle =
> {AsyncStatePrice.AsyncWaitHandle}
> WaitHandle.WaitAll(WaitHandles)
> Catch ex As Exception
> 'Throw (ex)
> End Try
> End Sub
>
> The method kicks off fine, but times-out before completion. I want this
to
> continue running regardless if the person who invoked the application
start
> event has their browser open or not. Is there a way to increase the
> timeout value for the thread through code. I don't want to change the
> session timeout for everyone, just this one process. Is there a better
> solution?
> Thanks
> --
> Message posted via http://www.dotnetmonster.com
Well, I tried the ThreadPool.QueueUserWorkItem approach, but it looks like
it terminates the thread after about 30 seconds.

Private WithEvents ServiceTimer As New System.Timers.Timer(600000)

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
ServiceTimer.Start()
End Sub

Private Sub PricePointsWakeUp(ByVal sender As Object, _
ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
Dim stateInfo As New TaskInfo("Price Points Update", 1)
If ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf
LongRunningTask), stateInfo) Then

Thread.Sleep(1000)

End If
End Sub

Public Class TaskInfo
Public Boilerplate As String
Public Value As Integer

Public Sub New(ByVal text As String, ByVal number As Integer)
Boilerplate = text
Value = number
End Sub
End Class

Shared Sub LongRunningTask(ByVal stateInfo As Object)

End Sub

--
Message posted via http://www.dotnetmonster.com
I did not realize you are wanting to fire your price point method every
600000. I thought you were wanting a queue that you could queue up long
running tasks, and use your timer to clear the queue. You can probably skip
the queue user work item since your timer is called from a thread in the
ThreadPool anyway. My mistake.

How do you know the thread is dying? Is it receiving a
ThreadAbortException. (that means the thread is timing out) or it is a Sql
timeout exception. If a Sql Timeout exception, you could increase the
CommandTimeout on your SqlCommand object.

If you are recieving the ThreadAbortException, you probably will have to
manually create a thread (not from the ThreadPool) to run the long running
task. Your timer shouldn't block waiting for it to complete, but probably
should fire the thread off and then return immediately.

If you need a sample to get a manually created thread off and running let me
know.

Sorry for misunderstanding you and basically giving you the run around. :)

bill

"JeffSinNHUSA via DotNetMonster.com" <forum@.DotNetMonster.com> wrote in
message news:4f599a23f948417db07f21a9143b623c@.DotNetMonste r.com...
> Well, I tried the ThreadPool.QueueUserWorkItem approach, but it looks
like
> it terminates the thread after about 30 seconds.
>
> Private WithEvents ServiceTimer As New System.Timers.Timer(600000)
> Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
> ServiceTimer.Start()
> End Sub
>
> Private Sub PricePointsWakeUp(ByVal sender As Object, _
> ByVal e As ElapsedEventArgs) Handles ServiceTimer.Elapsed
> Dim stateInfo As New TaskInfo("Price Points Update", 1)
> If ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf
> LongRunningTask), stateInfo) Then
> Thread.Sleep(1000)
> End If
> End Sub
> Public Class TaskInfo
> Public Boilerplate As String
> Public Value As Integer
> Public Sub New(ByVal text As String, ByVal number As Integer)
> Boilerplate = text
> Value = number
> End Sub
> End Class
> Shared Sub LongRunningTask(ByVal stateInfo As Object)
> End Sub
> --
> Message posted via http://www.dotnetmonster.com
No problem on the advice - I learned something new.

So back to the old code. I threw try catch blocks around everything, and
instead of throwing an exception, I emailed myself the esception info. I
also email myself as it loops thru the data it is processing. After about
6 iterations (which takes about 60 seconds) I stop receiving emails. Looks
like an exception isn't being thrown.

--
Message posted via http://www.dotnetmonster.com