Category Archives: programs

Easily save and restore CheckedListBox values in the Registry in C#

The example Easily save and restore a form’s settings in the Registry in C# shows one way you can save a form’s settings and the values placed in its controls. That example really just demonstrates the basic ideas and shows … Continue reading

Posted in forms, programs, registry | Comments Off on Easily save and restore CheckedListBox values in the Registry in C#

Convert camel case into underscore case in C#

Lately I’ve been doing a lot of C#-to-python conversion. The style in C# is to use camel case where you capitalize the first letter each each word after the first one in a variable’s name as in thisIsAVariableName. The style … Continue reading

Posted in programs, strings | Tagged , , , , , , , , | 4 Comments

Use the automatic code converters at developerFusion to convert C# code into Visual Basic, Ruby, and Python

The developerFusion web site provides code converters that let you translate between C#, Visual Basic, Ruby, and Python. One of the most important uses for reflection is analyzing code to figure out what it does. Once you know what the … Continue reading

Posted in programs, reflection, syntax | Tagged , , , , , , , , , , , , , , , | 7 Comments

Build an MRU list that uses project settings in C#

The post Build an MRU list in C# explains how to build an MRU list (most recently used list). That example stores recently used files in the system Registry. This example does the same thing but it stores file information … Continue reading

Posted in files, programs, registry | Tagged , , , , , , , , , , , , , | Comments Off on Build an MRU list that uses project settings in C#

Build an MRU list in C#

An MRU list (most recently used file list) displays in the File menu the files that a program has used most recently. If the user selects a file from the menu, the program reopens that file. This example builds an … Continue reading

Posted in files, programs, registry | Tagged , , , , , , , , , , , , , | 7 Comments

Make the user enter a password to use a program in C#

The example Display a simple password dialog before a program starts in C# displays a simple password form. It compares the value entered by the user with a string inside the program to decide whether the user entered the right … Continue reading

Posted in cryptography, dialogs, programs | Tagged , , , , , , , , , , | 1 Comment

Run user-entered code that modifies the program’s form in C#

The example Run user-entered code in C# shows how you can compile and execute code entered at run time. That example simply displays a message box and returns a DialogResult indicating which button the user pressed. This example shows how … Continue reading

Posted in algorithms, miscellany, programs, reflection | Tagged , , , , , , , , , , , , , , , , | Comments Off on Run user-entered code that modifies the program’s form in C#

Display memory usage in C#

This program displays the computer’s total and free physical, virtual, and page file memory usage. When it starts, the following code displays the system’s memory information in the program’s ListView control. // Prepare the ListView and display values. private void … Continue reading

Posted in memory, programs | Tagged , , , , , , , , , , , | Comments Off on Display memory usage in C#

Evaluate numeric expressions that are entered by the user in C#

This example shows one way to evaluate mathematical expressions entered by the user at runtime. Enter a numeric expression involving x and y in the upper text box. Then enter values for x and y in the lower text boxes … Continue reading

Posted in algorithms, mathematics, miscellany, programs, reflection | Tagged , , , , , , , , , , , | 2 Comments

List languages that you can compile at runtime in C#

The example Run user-entered code in C# shows how to let the user enter C# code, compile at runtime, and execute the result, but how do you know what languages you can compile that way? You might guess C# and … Continue reading

Posted in algorithms, miscellany, programs, reflection | Tagged , , , , , , , , , , , , , , , , , | 1 Comment