Download Project : GetNetworkIpAddress.zip
To get the ip address of the all the computer which is connected to the local area network .
· there is a way to get ip address there is dll also available which is returns the ip address and computer name which is connecter to your network.
· Download DLL From : GetLaneIpAddress_Nirav_Daraniya
How to use DLL in your application
a. First take one windows form, and then drag and drop the button control to it and also list box control to form control.
b. Now add dll to the project, this DLL is can not take any argument but its class name is “Class1” and it will return the Hash table.
Add namespace in project
Make object of the class which is define in DLL
Dim objClass1 As New Class1
Now generate button click event on your project
private void button1_Click(object sender, EventArgs e)
Dim aaaa As Hashtable
aaaa = sss.getIPAddress()
Foreach DictionaryEntry child In aaaa
ListBox1.Items.Add("PC Name : " + child.Key + " IP Address : " + child.Value)
*** if you want to do same possess via code then follow this steps.
1. first you have to a namespace
2. now .
Process netUtility = new Process();
netUtility.StartInfo.FileName = "net.exe";
netUtility.StartInfo.CreateNoWindow = true;
netUtility.StartInfo.Arguments = "view";
netUtility.StartInfo.RedirectStandardOutput = true;
netUtility.StartInfo.UseShellExecute = false;
netUtility.StartInfo.RedirectStandardError = true;
StreamReader streamReader =StreamReader(netUtility.StandardOutput.BaseStream, netUtility.StandardOutput.CurrentEncoding);
3. now make loop
string line = "";
while ((line = streamReader.ReadLine()) != null)
string myIP = Convert.ToString(System.Net.Dns.GetHostByName(line.Substring(2).Substring(0, line.Substring(2).IndexOf(" ")).ToUpper()).AddressList.ToString());
See Also :
- What is Class and Object in C#.net ?
- What is Encapsulation in C#.Net ?
- What is Abstract Class in C#.Net,How to use Abstract class in .net?
- Wht is Inheritance in c#.net ?
- What is Method Overloading in .Net?