' atoi1.vb Imports System Class ATOI1 Public Shared Sub Main() Dim str As String = "123456789" Dim num As Integer = Integer.Parse(str) Console.WriteLine(num) ' 出力:123456789 'str = "1234567890987654321" 'num = Integer.Parse(str) ' '例外:System.OverflowExceptionが発生 'str = "1,234,567,890" 'num = Integer.Parse(str) ' '例外:System.FormatExceptionが発生 End Sub End Class ' コンパイル方法:vbc atoi1.vb