
TimeOfDay Property | 471
The Language
Reference
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
Console.WriteLine(statusText & keepCount)
End Sub
Private Shared Sub DelayLoop(ByVal milliSecs As Integer)
' ----- Wait a while.
System.Threading.Thread.Sleep(milliSecs)
End Sub
End Class
Throw Statement
Syntax
Throw exception
exception (required; Exception or derived from Exception)
A System.Exception object representing the exception being thrown
Description
The Throw statement initiates an exception that can be handled using either structured
exception handling (with a
Try...Catch...Finally statement) or unstructured error
handling (with an
On Error statement).
Example
Dim positiveNumber As Integer
Try
' ----- Throw an exception if the user enters anything other
' than a positive number.
positiveNumber = CInt(InputBox("Enter number of items."))
If (positiveNumber <= 0) Then
Throw New Exception("Entry must be a positive number.")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
Version Differences
The Throw statement is new to VB under .NET.
See Also
Exception Class, Try...Catch...Finally Statement
TimeOfDay Property
Class
Microsoft.VisualBasic.DateAndTime
Syntax
Dim result As Date = DateAndTime.TimeOfDay