In VB, you can exit a sub procedure at any time by using Exit Sub statement. The Exit Sub statement is useful when you detect an invalid input and there is no reason to continue next code execution.
Console.WriteLine("Enter a date value:")
Dim datestr = Console.ReadLine()
If Not IsDate(datestr) Then ' If not a valid date format input then do not continue the next code
Dim dv = Date.Parse(datestr)
Console.WriteLine("You long date format is: " & FormatDateTime(dv, DateFormat.LongDate))
Posted by: Dara | post date: 02-18-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: