3
Answers

Get IP address and dns IP of network card

mike Delvotti

mike Delvotti

11y
3.7k
1
Guys,

I have seen a lot of examples of how to get the IP addressses of the local network card but they only get the local IP and not default gateway etc. I would like to get the following info and display onto labels on the form:

IP
Subnet mask
Gateway

Preffered DNS server
Alternative DNS

Is it possible? I would run this on form load event.
Answers (3)
0
Peter

Peter

NA 4 0 15y
That much I know.  My question is, why one PC converts 1 to string and gets "1" and the other does the same thing and gets "1.0"?
0
Manish Dwivedi

Manish Dwivedi

NA 8.3k 1.2m 15y
Hi

This is happening due to this res = "1.0" {string} while converting.

because you are using int.TryParse so u have to pass the values like 1,2,123,10 etc in the res parameter.

I think u got it.