Ağ Kontrolu
Bu uygulamamızda bilgisayarımızın ağa bağlı olup olmadığını ve hangi ad ile bağlı olduğunu göreceğiz. Aşağıdaki şekili inceleyiniz. Formunuza 1 adet button ve textBox ekleyin. textBox ın MultiLine özelliğini true yapın...Bahadirsa

Şekil 1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplica,tion1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            textBox1.Multiline = true;
            this.Text = "Ağ Bağlantısı Kontrol...Bahadirsa";
            this.MaximizeBox = false;
            this.Location = new Point(250, 250);
        }
        private void btnBaglan_Click(object sender, EventArgs e)
        {
            System.Net.IPHostEntry host;
            try
            {
            textBox1.Text = Environment.GetEnvironmentVariable("LOGONSERVER");
            host = System.Net.Dns.GetHostByName(textBox1.Text.Substring(2));
            textBox1.Text = textBox1.Text + Environment.NewLine + " Adıyla ağa bağlısınız. ";
            
                return;
                }
        catch 
            {
            textBox1.Text = "Ağ Bağlantınız Bulunmamaktadır.";
        }
            
     
        }
      
    }
}
//Bir sonraki makalede görüşmek üzere...Bahadirsa