Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

[C#] Source Code Computer Info [No Download]

Im not gonna write something long.
This simple C# program just gets the infomation of the computer.
Its simple and easy to understand it only involves strings and bools.
Its my first C# program that i made my self that means i haven't look at any tuts and i haven't stealed any codes from other sources
Code
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;
using System.Security.Principal;
using System.Net;
using System.Management;



namespace Computer_Info
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            label2.Text = "";
            label4.Text = "";
            label6.Text = "";
            label8.Text = "On/Off";
        }

        private void groupBox1_Enter(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            string computername;

            computername = WindowsIdentity.GetCurrent().Name.ToString();
            label2.Text = computername;

            string user;

            user = Dns.GetHostName();
            label4.Text = user;

            string os;

            os = System.Environment.OSVersion.ToString();

            label6.Text = os;

            bool capslock;
            
            capslock = Console.CapsLock;

            if (capslock == true)
            {
                label8.Text = "On";
            }
            else
            {
label8.Text = "Off";
            }

        }


        private void Form1_Load(object sender, EventArgs e)
        {
          
        }
    }
}

Pic of the program:
Spoiler (Click to View)
come no comments have some one even tried the code
Nice first program :D! You should add a project file.

And maybe if you add the VB.net version, you'll get more comments :

VB.net :
Code
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms
Imports System.Security.Principal
Imports System.Net
Imports System.Management

Namespace Computer_Info
    Public Partial Class Form1
        Inherits Form
        Public Sub New()
            InitializeComponent()
        End Sub

        Private Sub button2_Click(sender As Object, e As EventArgs)
            label2.Text = ""
            label4.Text = ""
            label6.Text = ""
            label8.Text = "On/Off"
        End Sub

        Private Sub button1_Click(sender As Object, e As EventArgs)
            Dim computername As String

            computername = WindowsIdentity.GetCurrent().Name.ToString()
            label2.Text = computername

            Dim user As String

            user = Dns.GetHostName()
            label4.Text = user

            Dim os As String

            os = System.Environment.OSVersion.ToString()

            label6.Text = os

            Dim capslock As Boolean

            capslock = Console.CapsLock

            If capslock = True Then
                label8.Text = "On"
            Else
                label8.Text = "Off"
            End If

        End Sub
    End Class
End Namespace

EDIT : 1000th post.
thanks for the vb.net version and thanks for the advice
nice code ! only if i new c#
Github
Keybase
Shoot me a PM


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by TazzyOpzApr 23, 2015 11:08 AM 7 2,163 Apr 23, 2015 11:08 AM
Last Post: TazzyOpz
[.NET] by sofien ouennJun 28, 2014 03:32 AM 11 1,139 Jun 28, 2014 03:32 AM
Last Post: sofien ouenn
[.NET] by IngenuityApr 28, 2014 04:01 AM 15 1,676 Apr 28, 2014 04:01 AM
Last Post: Ingenuity