Results 1 to 4 of 4

Thread: try catch

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    London
    Posts
    678

    try catch

    Hi,
    In my asp.net web appliaction using vb.net I am using a class file.
    In the class file there is database activity and I would like to place error handling in this class file.
    The question is that If I place the error handling in the class file, then how can the .aspx page show that error?
    i.e. I can place the try catch ex as exception in the class file but how will the .aspx page know what the error is so that the lblError control is updated.
    for example in vb 6 I used to use err.raise but how is this done in vb.net?
    Thanks

  2. #2
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    dunno if this will help: are you talking about the Throw method?

    btw do you know that there is a asp.net forum? http://www.vbforums.com/forumdisplay.php?forumid=31
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  3. #3
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Also

    Response.Write(exceptionvariable.ToString())
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  4. #4
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Question

    I think i might know what you want to do. You should create your own class that you can return with either success or failure, and a text message.

    Something like:
    VB Code:
    1. Public Class MyReturnValue
    2.     Public Success As Boolean = True
    3.     Public Message As String = ""
    4. End Class
    ~Peter


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width