C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Visual Studio »

.NET Windows Forms - Find all information about Computer


Posted Date: 27 Jun 2009    Resource Type: Code Snippets    Category: Visual Studio
Author: Viji RAJKUMARMember Level: Diamond    
Rating: 1 out of 5Points: 5 (Rs 5)



The NameSpace System.Environment is used to get all information about the computer.


The following Code Snippet is used to retrieve the following information about the computer.


1. User Name

2. Machine Name

3. Domain Name

4. System Root Directory

5. Current Directory

6. Logical Drives of the System

7. Version of Operating System

8. Command Line


Prerequisites:

1. Imports System.Environment


2. Drag and Drop a Label on the form and name it as lblComputerDetails


3. Drag a RichTextBox and drop on the form and name it as txtComputerDetails


4. Drag and Drop a Button on the form and name it as btnDisplayDetails


5. Click On the Button





Private Sub btnDisplayDetails_Click(ByVal sender As System.Object, ByVal e As_
System.EventArgs) Handles btnDisplayDetails.Click

'label

lblComputerDetails.Text = "Computer Details"



'User Name

txtComputerDetails.Text = "UserName: " & Environment.UserName.ToString & Environment.NewLine



'Computer Name

txtComputerDetails.AppendText("Computer Name: " & Environment.MachineName.ToString & Environment.NewLine)



'Domain Name

txtComputerDetails.AppendText("Domain Name: " & Environment.UserDomainName.ToString & Environment.NewLine)



'System root directory

txtComputerDetails.AppendText("Root Directory: " & Environment.SystemDirectory.ToString & Environment.NewLine)



'Current Directory

txtComputerDetails.AppendText("Current Directory: " & Environment.CurrentDirectory.ToString & Environment.NewLine)



'logical drives

txtComputerDetails.AppendText("Logical Drives: " & Environment.NewLine)


For i As Integer = 0 To Environment.GetLogicalDrives.Length - 1

txtComputerDetails.AppendText(Environment.GetLogicalDrives(i))

txtComputerDetails.AppendText(Environment.NewLine)

Next


'Version of operating system


txtComputerDetails.AppendText("Operating System Version: " & Environment.OSVersion.ToString & Environment.NewLine)



'Command Line

txtComputerDetails.AppendText("Command Line: " & Environment.CommandLine.ToString & Environment.NewLine)



End Sub




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
.NET Windows Forms - Find all information about Computer  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Splitting Number
Previous Resource: Runtime Create Database and Table
Return to Discussion Resource Index
Post New Resource
Category: Visual Studio


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use