Wrox Programmer Forums
|
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 10th, 2008, 10:04 AM
Authorized User
 
Join Date: Apr 2008
Posts: 85
Thanks: 10
Thanked 0 Times in 0 Posts
Default Problem with cathing exeption

Hi All

I am trying to abort the thread and catch the ThreadAbortException but after aborting thread it is not throwing exeption.


Protected Sub Page_Load(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles Me.Load

        Try
            T = New Thread(AddressOf LongTimeTask)
            T.Start()


            T.Abort()

        Catch ex As ThreadAbortException
            Dim str As String

            str = CType(ex.ExceptionState, String)

        End Try

    End Sub

 Public Sub LongTimeTask()


        Dim index As Integer

        For index = 1 To 20000

            Label1.Text = index.ToString()

        Next

End Sub

can u please tell me where i m doing wrong or how to catch exeption.

Thanks in advance.
-Nelly

 
Old June 10th, 2008, 10:43 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hi there..

The exception occurs inside the thread, not in the abort call.
The exception should be on the procedure LongTimeTask as specify by MSDN:

http://msdn.microsoft.com/es-es/libr...DownFilterText

is the spanish translation, look for the english article.

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error message exeption occured Toran Classic ASP Databases 0 March 10th, 2004 06:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.