kak.mca
New member
- Joined
- Jan 28, 2008
- Messages
- 3
- Programming Experience
- Beginner
Hi,
Good morning to All.
This post might look like silly, but I couldn't get clear idea on this. I need some help to proceed further. Please help me on this.
I can express my doubt with one example.
Now, my doubt is:
How can one novice developer know the exception name DivideByZeroException to put in the code. If he is intellegent, then he can predict in advance that chances are there for division by zero error to occur. But how can he know that DivideByZeroException is the exception name to handle such type of situation?
In other words:
How can I get those exception names(like, for example: DivideByZeroException) to put in exception block for exceptions that might occur.
Thanks in Advance,
Ashok kumar.
Good morning to All.
This post might look like silly, but I couldn't get clear idea on this. I need some help to proceed further. Please help me on this.
I can express my doubt with one example.
PHP:
Public Class ThrowDemo
Private Sub ThrowDemo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim x As Single = getAverage(0, 100)
MessageBox.Show(x)
End Sub
Private Function getAverage(ByVal items As Integer, ByVal total As Integer) As Single
Try
Dim sngAverage As Single = CSng(total / items)
Return sngAverage
Catch ex As DivideByZeroException
MessageBox.Show("Calculation generated DivideByZero Exception")
End Try
End Function
End Class
Now, my doubt is:
How can one novice developer know the exception name DivideByZeroException to put in the code. If he is intellegent, then he can predict in advance that chances are there for division by zero error to occur. But how can he know that DivideByZeroException is the exception name to handle such type of situation?
In other words:
How can I get those exception names(like, for example: DivideByZeroException) to put in exception block for exceptions that might occur.
Thanks in Advance,
Ashok kumar.