如何在标签上显示我的dns和ip [英] how to display my dns and ip on a label
本文介绍了如何在标签上显示我的dns和ip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想显示我的IP地址和dn名称,我已经尝试过此代码来获取ip,但在System.Net.Dns.Resolve中给了我警告,代码为:
hi there i want to display my ip address and the dn name i have tried this code to get the ip but its giving me warning in System.Net.Dns.Resolve, the code is:
Dim m As System.Net.IPHostEntry = System.Net.Dns.Resolve(System.Net.Dns.GetHostName)
lbl3.Text &= "IP: " & m.ToString
lbl3.Location = New Point(100, 160)
Me.Controls.Add(lbl3)
任何人都可以通过警告和dns来帮助我,一如既往.
can anyone help me with this warning and with dns, thanks as always.
推荐答案
嘿,我解决了这个问题,我认为这对每个人都将是有用的
hey i solves this, i think it will be useful for everyone
Dim _host As String
Dim _IP As String
_host = System.Net.Dns.GetHostName()
_IP = System.Net.Dns.GetHostByName(_host).AddressList(0).ToString()
lbl3.Text = "DN: " & _host & vbNewLine
lbl3.Text &= "IP:" & _IP
lbl3.Location = New Point(100, 160)
Me.Controls.Add(lbl3)
这篇关于如何在标签上显示我的dns和ip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文