- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Net.NetworkInformation;
- namespace internet
- {
- public partial class internet : Form
- {
- public bool check_connection;
- public internet()
- {
- InitializeComponent();
- }
- private void internet_Load(object sender, EventArgs e)
- {
- check_connection = NetworkInterface.GetIsNetworkAvailable();
- if(check_connection)
- {
- this.pictureBox1.Image = global::internet.Properties.Resources._4;
- label1.Text = "Connected";
- }
- }
- }
- }
With the help of this code snippet we can check internet connection is available or not using simple c# windows application for.
