Get PC Information

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using Microsoft.Win32;
using System.Collections;
private void Form1_Load(object sender, EventArgs e)

{
// I am displaing the information in a label so that it is esay to read .
// just place 5 labels in the form and call this code.

// This line is for getting the system directory
label1.Text = Environment.SystemDirectory;

// This line is for getting the Machine name
label2.Text = Environment.MachineName;

// This line is for getting the system directory (where this project is located)
label3.Text = Environment.CurrentDirectory;

// // This line is for getting the OS version
label4.Text = Environment.OSVersion.ToString();

IDictionary environmentVariables = Environment.GetEnvironmentVariables();

string str2 = “”;

string str3 = “”;

foreach (DictionaryEntry de in environmentVariables)

{
str2 = de.Key.ToString();

str3 = str3 + str2 + ” , “;

}
label5.Text = str3;
}

Explore posts in the same categories: C#

Comment: