Login Register






[VB.NET] Getting your own IP filter_list
Author
Message
RE: [VB.NET] Getting your own IP #3
(10-26-2015, 08:37 AM)Distance Wrote: getting your own ip in vb.net 

Code:
Private Function GetMyIP()         Dim ExternalIP As String = "Null"           Try             ExternalIP = (New WebClient()).DownloadString("http://checkip.dyndns.org/")             ExternalIP = (New Regex("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}")) _                          .Matches(ExternalIP)(0).ToString()         Catch exc As Exception             ExternalIP = "Null"         End Try           Return ExternalIP End Function

Way more work than needed but 1 main fix, this:
Code:
Dim ExternalIP As String = "Null"
Should be:
Code:
Dim ExternalIP As String
Or
Code:
Dim ExternalIP As String = ""
Or
Code:
Dim ExternalIP As String = null
Spoiler:
Spoiler:

Reply





Messages In This Thread
[VB.NET] Getting your own IP - by Distance - 10-26-2015, 08:37 AM