Click here to Skip to main content
15,791,846 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Do you mind if I request for complete source code C# .NET 4 about Get IP and Physical Address in LAN.
Posted
Comments
[no name] 23-Jul-13 9:10am    
"Do you mind if I request for complete source code" yes because it is rude and we are here to help people not do their work for them.
renish patel 23-Jul-13 9:16am    
Agree with ThePhantomUpvoter.. Please first try your self then after if error occurs or need help then discuss here
[no name] 23-Jul-13 20:13pm    
The real answer to your question is that there is a mountain of information and code on the net about this. Part of becoming effective as a programmer is to learn how to use this resource for yourself. Google is where to start.

using System; using System.Collections.Generic;
using System.ComponentModel;
using System.Data; using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Management;
using System.Net.Sockets; using System.Collections; //using System.ComponentModel;using System.Windows.Forms;using System.Data;
namespace test {
public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

string s="",mac="";

string hostInfo = Dns.GetHostName();

System.Net.IPAddress[] addressList = Dns.GetHostByName(Dns.GetHostName()).AddressList;

for (int i = 0; i < addressList.Length; i ++)

{

s += addressList[i].ToString(); } ManagementClass mc;

mc=new ManagementClass("Win32_NetworkAdapterConfiguration"); ManagementObjectCollection moc=mc.GetInstances();

foreach(ManagementObject mo in moc)

{

if(mo["IPEnabled"].ToString()=="True")

mac=mo["MacAddress"].ToString();

this.textBox1.AppendText(mac + "\n\r\n\r");

}

this.Text+=hostInfo;

this.Text+=s;

this.Text+=mac;

// button1.Enabled=false; button2.Focus();
}
}
}
 
Share this answer
 
Yes, we mind. We're not going to do your work for you.
 
Share this answer
 
Thank you everybody, I not forget Obligation. (^_^)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900