Tag Archives: system

Get a hard drive serial number in C#

The example Get a disk volume serial number in C# shows how you can find the serial number for a disk volume such as C:\. If you reformat or repartition the drive, however, the volume serial number may change. This … Continue reading

Posted in system | Tagged , , , , , , , , , , , | Leave a comment

Get a disk volume serial number in C#

This example uses the GetVolumeInformation API function so get a disk volume’s serial number. It starts by using the System.Rumtime.InteropServices namespace and by declaring the API function. using System.Runtime.InteropServices; … [DllImport(“kernel32.dll”)] private static extern long GetVolumeInformation( string PathName, StringBuilder VolumeNameBuffer, … Continue reading

Posted in system | Tagged , , , , , , , , , , | 2 Comments

Get the computer’s registered owner and organization in C#

In Windows 98, the system’s registered owner and company name is stored in the following Registry keys: SOFTWARE\Microsoft\Windows\CurrentVersion\RegisteredOwner SOFTWARE\Microsoft\Windows\CurrentVersion\RegisteredOrganization In Windows NT and later, the registered owner and company is stored in the following keys: SOFTWARE\Microsoft\Windows NT\CurrentVersion\RegisteredOwner SOFTWARE\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization This … Continue reading

Posted in registry, system | Tagged , , , , , , , , , | Leave a comment

Get the computer’s operating system in C#

This example uses the following code to display the operating system version when it starts. private void Form1_Load(object sender, EventArgs e) { OperatingSystem os_info = System.Environment.OSVersion; lblOs.Text = os_info.VersionString + “\n\nWindows ” + GetOsName(os_info); } This example simply gets the … Continue reading

Posted in system | Tagged , , , , , , , , , | Leave a comment

Write values in the Registry in C#

The example Read Registry values (to get the desktop icon size) in C# shows how to read values from the Registry. This example shows how to write values into the Registry and uses that ability to refresh the desktop icons … Continue reading

Posted in registry, system | Tagged , , , , , , , , , , | Leave a comment

Book Errata Page: The C# Helper Top 100

This is the errata page for my book The C# Helper Top 100, The 100 most popular posts at csharphelper.com. If you find mistakes, please post them here in the Leave a Reply box at the bottom of the page. … Continue reading

Posted in .NET, algorithms, books, C#, C# programming | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 2 Comments

Book Discussion Page: The C# Helper Top 100

This is a discussion page for my book The C# Helper Top 100, The 100 most popular posts at csharphelper.com. Please post questions, thoughts, and suggestions here in the “Leave a Reply” box at the bottom of the page. I … Continue reading

Posted in .NET, algorithms, books, C#, C# programming | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 2 Comments

Table of Contents: The C# Helper Top 100

This is a brief summary of the book’s table of contents. Introduction Part I. Serialization 1. Read a CSV File into an Array (1) 2. Use JSON to Serialize and Deserialize Objects (49) Part II. Graphing 3. Draw a Graph … Continue reading

Posted in .NET, algorithms, books, C#, C# programming | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 2 Comments

New Book: The C# Helper Top 100

I’m happy to announce my latest book, The C# Helper Top 100, The 100 most popular posts at csharphelper.com. It describes the 100 most popular posts on the C# Helper web site. This is my 32nd book and my second … Continue reading

Posted in .NET, algorithms, books, C#, C# programming | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

List USB devices in C#

This program uses WMI (Windows Management Instrumentation) to query for USB devices. To use WMI, add a references to System.Management and add a using System.Management directive. When it starts, this example uses the following code to list USB devices. // … Continue reading

Posted in system | Tagged , , , , , , , | Leave a comment