VB.NET is nothing

is operator and nothing keyword are used together to check whether an object variable does not refer to any object. The nothing value can be assigned to all types of variables and it is default value of a variable when it is declared. However, when nothing is used with the is keyword, only reference and nullable types are accepted.
In VB, the nullable variable can have a value or can have no value (not available) at all and it is declared with ? sign

(e.g. Dim x? As integer).

Module Module1

   Sub Main()
     Dim x As Object
     If x Is Nothing Then
        Console.WriteLine("Nothing")
     End If
     Console.ReadLine()
   End Sub
End Module

Posted by: shalo | post date: 02-06-2013 | Subject: VB.NET Programming Language




This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.