本文整理汇总了VB.NET中System.TimeZoneNotFoundException.TimeZoneNotFoundException构造函数的典型用法代码示例。如果您正苦于以下问题:VB.NET TimeZoneNotFoundException构造函数的具体用法?VB.NET TimeZoneNotFoundException怎么用?VB.NET TimeZoneNotFoundException使用的例子?那么恭喜您, 这里精选的构造函数代码示例或许可以为您提供帮助。
在下文中一共展示了TimeZoneNotFoundException构造函数的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