[C#] Source Code Computer Info [No Download] - Donace - Jun 13, 2010
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:
[IMG]http://i50.[censored].com/1dypnl.png[/IMG]
* - Donace - Jun 14, 2010
come no comments have some one even tried the code
* - Charny - Jun 14, 2010
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.
* - Donace - Jun 14, 2010
thanks for the vb.net version and thanks for the advice
* - DaRkReD - Jun 14, 2010
nice code ! only if i new c#
|