Try |
02 | 'Declare new collection |
03 | Dim IpCollection As New Collection |
04 |
05 | 'Retrieve IP address entries |
06 | 'To get a www address |
07 | Dim i As Integer |
08 |
09 | Dim ipE As Net.IPHostEntry = System.Net.Dns.GetHostEntry(-HOSTNAME-) |
10 | Dim IpA() As Net.IPAddress = ipE.AddressList |
11 |
12 | For i = 0 To IpA.GetUpperBound(0) |
13 | 'Add all to list |
14 | IpCollection.Add(IpA(i).ToString) |
15 | Next |
16 |
17 | 'Select the right address- |
18 |
19 | Dim Ipaddress As String |
20 |
21 | Ipaddress = IpCollection.GetValue(-Num-) |
22 |
23 | Catch ex As Exception |
24 | MsgBox( "An error has occured" ) |
25 | End Try |