Hello sir,
Please Give me any examples of Exception Handling Techniques in VB.Net 2005.
Thanks sir.....
Please Give me any examples of Exception Handling Techniques in VB.Net 2005.
Thanks sir.....
Try 'Check if the there is Help.chm 'Help.ShowHelp(Me, Application.StartupPath & "\Help.chm") Or System.Diagnostics.Process.Start(Application.StartupPath & "\Help.chm") Catch ex As Exception 'Display error message if the file is not found MessageBox.Show(ex.Message, "Help", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try
Try 'Put your code in here Catch nex as NullReferenceException 'This is how you can catch specific types of exceptions and handle them separately. Catch ex as Exception 'If you do not specify an exception type then this will catch it. Kind of an all ' purpose catchers mitt. Finally 'This is nifty, anything put into this section will run REGARDLESS of any errors that are caught. 'This is especially helpful for objects declared outside of the try catch block like FileStreams or data objects 'because you can handle and dispose of them properly here instead of having to code/recode in several areas. End Try
Try 'Jump to get to the other side Catch 'If you don't make it, this is your safety harnass MessageBox(ex.Message) 'Why didn't you complete the jump? Finally 'Whether you complete the jump or not, you can get into your car and drive home End Try 'Welcome home!
Comment