Try Catch Overkill

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pigeonrandle

    Try Catch Overkill

    Hi,
    Does this bit of code represent complete overkill?!

    Try

    'create a treenode
    Dim tn as new TreeNode()
    'add it to a treeview
    tv.Nodes.Add(tn )
    'do some other stuff

    Catch ee As Exception 'something weird has happened

    Try

    'try to remove the treenode from the treeview
    if tn.TreeView <Null Then tn.Remove()

    Catch ee2 As Exception 'now things have got really dire

    MessageBox.Show ("Would a function like TreeNode.Remove () ever cause

    a random exception that i should worry about?")

    End Try

    End Try



    What i basically mean is ... if this situation arises then someone has
    probably poured a cup of coffee into the computer so i won't have to
    worry about my software/data being 'recoverable', or will this sort of
    *hilarious* thing never happen?

    Explanations, musings and criticism all welcome,
    James Randle.

  • pigeonrandle

    #2
    Re: Try Catch Overkill

    Anyone else having problems posting on Google Groups? Or have i just
    got some weird echo thang going on?


    pigeonrandle wrote:
    Hi,
    Does this bit of code represent complete overkill?!
    >
    Try
    >
    'create a treenode
    Dim tn as new TreeNode()
    'add it to a treeview
    tv.Nodes.Add(tn )
    'do some other stuff
    >
    Catch ee As Exception 'something weird has happened
    >
    Try
    >
    'try to remove the treenode from the treeview
    if tn.TreeView <Null Then tn.Remove()
    >
    Catch ee2 As Exception 'now things have got really dire
    >
    MessageBox.Show ("Would a function like TreeNode.Remove () ever cause
    >
    a random exception that i should worry about?")
    >
    End Try
    >
    End Try
    >
    >
    >
    What i basically mean is ... if this situation arises then someone has
    probably poured a cup of coffee into the computer so i won't have to
    worry about my software/data being 'recoverable', or will this sort of
    *hilarious* thing never happen?
    >
    Explanations, musings and criticism all welcome,
    James Randle.

    Comment

    • Michael C

      #3
      Re: Try Catch Overkill

      "pigeonrand le" <pigeonrandle@h otmail.comwrote in message
      news:1162336921 .310867.194750@ e3g2000cwe.goog legroups.com...
      Anyone else having problems posting on Google Groups? Or have i just
      got some weird echo thang going on?
      Use a newsreader like outlook express.

      Michael


      Comment

      • Chris Dunaway

        #4
        Re: Try Catch Overkill

        pigeonrandle wrote:
        Anyone else having problems posting on Google Groups? Or have i just
        got some weird echo thang going on?
        >
        Here, lately, I have had some glitches with Google Groups. I think
        they're working on the new version which is in beta now. Here's the
        link if you want to check it out:



        Comment

        • Mythran

          #5
          Re: Try Catch Overkill



          "Michael C" <nospam@nospam. comwrote in message
          news:OxeACTU$GH A.1784@TK2MSFTN GP04.phx.gbl...
          "pigeonrand le" <pigeonrandle@h otmail.comwrote in message
          news:1162336921 .310867.194750@ e3g2000cwe.goog legroups.com...
          >Anyone else having problems posting on Google Groups? Or have i just
          >got some weird echo thang going on?
          >
          Use a newsreader like outlook express.
          >
          Michael
          >
          I actually enjoy using Windows Live Mail desktop beta :) Just going a
          little slow (what do ya expect from a beta though ;p )

          HTH,

          Mythran


          Comment

          Working...