Saturday, September 17, 2011

Variable scope in try catch statement

public class Test
   public Shared Sub Main


        Try
            Dim As Integer = CInt("bad value")
        Catch ex As InvalidCastException
            Dim txt As String = "InvalidCastException"
            Console.WriteLine(txt)
        Catch ex As Exception
            Dim txt As String = "Exception"
            Console.WriteLine(txt)
        End Try

   End Sub
End class

No comments:

Post a Comment

Explain the different parts that constitute ASP.NET application.

Content, program logic and configuration file constitute an ASP.NET application. Content files Content files include static text, images ...