Following code snippet throws an error when padding the last part with 0, and the last part is 008, 009, 018, 019, 028, 029 etc. Anyone got an idea why?
Sub Main()
Dim fixed As String = "192.168.0."
Dim ip1, ip2 As String
For i As Int32 = 1 To 255
ip1 = fixed & Convert.ToString(i)
Console.Write(ip1 & " - ")
Try
Console.WriteLine(My.Computer.Network.Ping(ip1))
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
ip2 = fixed & Convert.ToString(i).PadLeft(3, "0"c)
Console.Write(ip2 & " - ")
Try
Console.WriteLine(My.Computer.Network.Ping(ip2))
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
Next
End Sub