C#.net

List the names of all the computers in the network on a combobox



In this simple article you will learn how you can bring the IP address’s of all the machines in a local network on to a combobox

Create a C# windows application project.Insert a combobox into the form

using System;
using System.Net;

Insert the code below into the page load of the form

String strHostName = Dns.GetHostName();
Console.WriteLine(“Host Name: ” + strHostName);

// Find host by name
IPHostEntry iphostentry = Dns.GetHostByName(strHostName);

// Enumerate IP addresses
int nIP = 0;
foreach(IPAddress ipaddress in iphostentry.AddressList)
{
combobox1.items.add(ipaddress.ToString());
}

Share

Thanks for reading my blog. If you like what I write, why not subscribe to my feed?

If you are busy, I can send the latest post to your email. Just subscribe to my email updates.

 

Enter your email address:

Delivered by FeedBurner

Discussion

No comments for “List the names of all the computers in the network on a combobox”

Post a comment