Use Argument Exception : Exception System « Development « VB.Net

VB.Net
1. 2D
2. Application
3. Class
4. Data Structure
5. Database ADO.net
6. Development
7. Event
8. File Directory
9. Generics
10. GUI
11. Language Basics
12. Network Remote
13. Thread
14. Windows System
15. XML
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net Tutorial
VB.Net » Development » Exception SystemScreenshots 
Use Argument Exception
Use Argument Exception

Imports System
Imports System.Collections

Public Class MainClass
    
    Shared Sub Main(ByVal args As String())
        Try
            Dim rect As New DrawableRectangle(10200, -100)
        Catch ex As Exception
            Console.WriteLine(ex.Message)
        End Try

    End Sub

End Class

Public Class DrawableRectangle
    Public Sub New(ByVal new_x As Integer, ByVal new_y As Integer, ByVal new_width As Integer, ByVal new_height As Integer)
        ' Verify that new_width > 0.
        If new_width <= Then
            ' Throw an ArgumentException.
            Dim ex As New ArgumentException_
                "DrawableRectangle must have a width greater than zero", _
                    "new_width")
            Throw ex
        End If

        ' Verify that new_height> 0.
        If new_height <= Then
            ' Throw an ArgumentException.
            Throw New ArgumentException_
                "DrawableRectangle must have a height greater than zero", _
                    "new_height")
        End If

    End Sub

End Class

           
       
Related examples in the same category
1. Parse Number ExceptionParse Number Exception
w_w___w___.___j___a__va_2__s_.co___m___ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.