欢迎光临
我们一直在努力

查询本机IP-.NET教程,评论及其它

建站超值云服务器,限时71元/月

using system;

using system.net;

using system.drawing;

using system.collections;

using system.componentmodel;

using system.windows.forms;

using system.data;

namespace getip

{

/// <summary>

/// form1 的摘要说明。

/// </summary>

public class form1 : system.windows.forms.form

{

private system.windows.forms.textbox textbox1;

private system.windows.forms.label label1;

/// <summary>

/// 必需的设计器变量。

/// </summary>

private system.componentmodel.container components = null;

public form1()

{

//

// windows 窗体设计器支持所必需的

//

initializecomponent();

string s="";

system.net.ipaddress[] addresslist = dns.gethostbyname(dns.gethostname()).addresslist;

for (int i = 0; i < addresslist.length; i ++)

{

s += addresslist[i].tostring();

}

this.textbox1.text = s;

//

// todo: 在 initializecomponent 调用后添加任何构造函数代码

//

}

/// <summary>

/// 清理所有正在使用的资源。

/// </summary>

protected override void dispose( bool disposing )

{

if( disposing )

{

if (components != null)

{

components.dispose();

}

}

base.dispose( disposing );

}

#region windows form designer generated code

/// <summary>

/// 设计器支持所需的方法 – 不要使用代码编辑器修改

/// 此方法的内容。

/// </summary>

private void initializecomponent()

{

this.textbox1 = new system.windows.forms.textbox();

this.label1 = new system.windows.forms.label();

this.suspendlayout();

//

// textbox1

//

this.textbox1.location = new system.drawing.point(72, 8);

this.textbox1.name = "textbox1";

this.textbox1.size = new system.drawing.size(104, 21);

this.textbox1.tabindex = 0;

this.textbox1.text = "";

//

// label1

//

this.label1.autosize = true;

this.label1.location = new system.drawing.point(8, 16);

this.label1.name = "label1";

this.label1.size = new system.drawing.size(60, 14);

this.label1.tabindex = 1;

this.label1.text = "自己的ip:";

//

// form1

//

this.autoscalebasesize = new system.drawing.size(6, 14);

this.clientsize = new system.drawing.size(192, 45);

this.controls.addrange(new system.windows.forms.control[] {

this.label1,

this.textbox1});

this.name = "form1";

this.text = "form1";

this.resumelayout(false);

}

#endregion

/// <summary>

/// 应用程序的主入口点。

/// </summary>

[stathread]

static void main()

{

application.run(new form1());

}

}

}

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 查询本机IP-.NET教程,评论及其它
分享到: 更多 (0)

相关推荐

  • 暂无文章