using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string ipadres = textBox1.Text + "." + textBox2.Text + "." + textBox3.Text + "."; for (int i = 1; i <= 255; i++) { if (IsOnline(ipadres+i)) { textBox5.AppendText("Het adres " + (ipadres+i) + " is geldig\n"); } else { textBox5.AppendText("Het adres " + (ipadres+i) + " is ongeldig\n"); } } } private static bool IsOnline(string naamOfAdres) { System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping(); return (ping.Send(naamOfAdres, 1000, new byte[20]).Status == System.Net.NetworkInformation.IPStatus.Success); } } }