本文整理匯總了VB.NET中System.InvalidTimeZoneException.InvalidTimeZoneException構造函數的典型用法代碼示例。如果您正苦於以下問題:VB.NET InvalidTimeZoneException構造函數的具體用法?VB.NET InvalidTimeZoneException怎麽用?VB.NET InvalidTimeZoneException使用的例子?那麽, 這裏精選的構造函數代碼示例或許可以為您提供幫助。
在下文中一共展示了InvalidTimeZoneException構造函數的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: HandleInnerException
Private Sub HandleInnerException()
Dim timeZoneName As String = "Any Standard Time"
Dim tz As TimeZoneInfo
Try
tz = RetrieveTimeZone(timeZoneName)
Console.WriteLine("The time zone display name is {0}.", tz.DisplayName)
Catch e As TimeZoneNotFoundException
Console.WriteLine("{0} thrown by application", e.GetType().Name)
Console.WriteLine(" Message: {0}", e.Message)
If e.InnerException IsNot Nothing Then
Console.WriteLine(" Inner Exception Information:")
Dim innerEx As Exception = e.InnerException
Do
Console.WriteLine(" {0}: {1}", innerEx.GetType().Name, innerEx.Message)
innerEx = innerEx.InnerException
Loop While innerEx IsNot Nothing
End If
End Try
End Sub
Private Function RetrieveTimeZone(tzName As String) As TimeZoneInfo
Try
Return TimeZoneInfo.FindSystemTimeZoneById(tzName)
Catch ex1 As TimeZoneNotFoundException
Throw New TimeZoneNotFoundException( _
String.Format("The time zone '{0}' cannot be found.", tzName), _
ex1)
Catch ex2 As InvalidTimeZoneException
Throw New InvalidTimeZoneException( _
String.Format("The time zone {0} contains invalid data.", tzName), _
ex2)
End Try
End Function