我要编写一个获取外网ip的vb程序
原理是 用shell将本地ipconfig 保存到d:\ip.txt
然后让vb读取 这个文本文件 并显示在 text控件里
要如何 实现?
參考答案:function LoadText(byval FileName as string) as string
dim i as integer , txt as string,cl as string
open filename for input as i
do while not eof(i)
if not txt="" then txt=txt & vbcrlf
line input i,cl
txt=txt & cl
loop
loadtext=txt
end function
假如你想点 Command1时在 Text1 中显示 D:\text.txt 中的文本,请像这样做
private sub Command_Click()
text1=loadtext("D:\text.txt")
end sub