VB.Net Tutorial/Data Type/Short

Материал из VB Эксперт
Перейти к: навигация, поиск

MinValue and MaxValue of Short

public class Test
   public Shared Sub Main
               Dim sNum As Short
               Console.WriteLine("Short: " & sNum.MinValue & " to " & sNum.MaxValue)
   End Sub
End class
Short: -32768 to 32767

Short Overflow

Module Module1
    Sub Main()
        Dim Value As Short = 32767
        Value = Value + 1
    End Sub
End Module
Unhandled Exception: System.OverflowException: Arithmetic operation resulted in an overflow.
   at Module1.Main()