Tag Archives: programs

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 , , , , , , , , , , , , , | Leave a comment

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 , , , , , , , , , , , , , | 3 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 , , , , , , , , , , , , , , , , | Leave a comment

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 , , , , , , , , , , , | Leave a comment

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

Run user-entered code in C#

This example shows how to compile and run user-entered code at run time. The form includes the following using statements. using System.CodeDom.Compiler; using System.Reflection; The following code executes when you click the Run button. // Compile and execute the code. … Continue reading

Posted in algorithms, miscellany, programs, reflection | Tagged , , , , , , , , , , , , , , , , | 13 Comments

Let a thread call a form’s methods in C#

When the user clicks the Start Thread button, this program runs a counter on a separate thread. Every second the counter updates the form’s Value variable. It then displays the thread’s number and the new Value in the ListBox at … Continue reading

Posted in algorithms, programs, system, threading | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Run threads with different priorities in C#

This example runs several different threads at different priorities. Each of the threads executes the following Counter class’s Run method. class Counter { // This counter’s number. public string Name; // Initializing constructor. public Counter(string name) { Name = name; … Continue reading

Posted in algorithms, programs, system, threading | Tagged , , , , , , , , , , , , , , , , , , , , | Leave a comment