最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
vb.net显示用户ip 地址代码
时间:2022-06-25 05:34:27 编辑:袖梨 来源:一聚教程网
获取当前电脑名:system.net.dns.gethostname()
根据电脑名取出全部ip地址:system.net.dns.resolve(电脑名).addresslist 或
者 system.net.dns.gethostbyname(电脑名).addresslist根据ip地址取出电脑名
:system.net.dns.resolve(ip地址).hostname 下面我们就用一个实例来看如何获
取本机的ip地址,并获得我们的主机名称。
host and ip address
应用实例
在form_load事件中加入如下代码:
private sub form1_load(byval sender as system.object, byval e as
system.eventargs) handles mybase.load
dim address() as system.net.ipaddress
dim i as integer
address = system.net.dns.gethostbyname(system.net.dns.gethostname
()).addresslist
textbox1.text = system.net.dns.gethostname().tostring()
for i = 0 to ubound(address)
textbox2.text = textbox2.text & address(i).tostring() & chr(13) + chr
(10)
next
end sub
相关文章
- 无限暖暖神秘作者任务怎么做 神秘作者任务流程攻略 09-18
- 如鸢董奉怎么玩 董奉玩法攻略 09-18
- 嘟嘟脸恶作剧活泼队怎么搭配 活泼队搭配推荐 09-18
- 如鸢曹植值得抽吗 曹植抽取建议 09-18
- 如鸢主线9-13王允低练度怎么过 主线9-13王允低练度过关攻略 09-18
- 嘟嘟脸恶作剧薇尔薇特角色如何 09-18