Category Archives: user interface

Make the user enter a float in C#

The posts Preview TextBox changes in C# and Preview TextBox changes in C#, Part 2 show how you can make a TextBox accept only integers. This example is similar except it makes a TextBox only accept floats. This change is … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , , , , , , , | Leave a comment

Preview TextBox changes in C#, Part 2

Part 1 of this post explained how the example previews changes made by keyboard events. It then accepts or cancels the changes depending on whether the TextBox control’s new value is a valid integer (or the start of one as … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , , , , | Leave a comment

Preview TextBox changes in C#

One of the more annoying omissions from the Windows Forms controls is a way to preview changes to a TextBox before they occur. For example, suppose you want the user to enter a floating point value in a TextBox. The … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , , , , | 2 Comments

Safely manage documents in C#

This is a pretty involved example that shows how to safely manage documents. The pieces are all simple but there are a lot of tightly integrated pieces. This example lets you create, edit, open, and save files in text and … Continue reading

Posted in files, forms, user interface | Tagged , , , , , , , , , , , , , , , , | 1 Comment

Make Ctrl+A select all of the text in a TextBox in C#

Often it’s convenient for the user to be able to press Ctrl+A to select all of the text in the TextBox that has the focus. Strangely that’s not the default behavior for the TextBox. Perhaps the TextBox doesn’t handle Ctrl+A … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , , | Leave a comment

Use a ProgressBar in C#

This example shows how to use a ProgressBar to show the progress of a long task. This is a very simple example that performs a synchronous task. I created the ProgressBar at design time. I left its Minimum property set … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , , | Leave a comment

Make pop buttons in C#

This example produces an interesting visual effect that I call “pop buttons.” The buttons grow and shrink when the mouse moves over them. The technique is remarkably simple and adds some extra interactivity to an otherwise ordinary program. The program’s … Continue reading

Posted in controls, fonts, user interface | Tagged , , , , , , , , , , , , , , , | Leave a comment

Display reusable dialog forms in C#

The example Make a dialog with standard dialog features in C# shows the most common approach to making dialogs. Whenever it needs to display the dialog, the main program initializes a new instance of it and displays it. If the … Continue reading

Posted in dialogs, user interface | Tagged , , , , , , , , , , , | Leave a comment

Make a TextBox with auto-complete in C#

It’s not too hard to make a TextBox provide an auto-complete feature. In fact, the TextBox control offers three auto-complete styles. This example demonstrates those styles. To provide auto-complete, you need to set the following three TextBox properties. AutoCompleteMode – … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , | Leave a comment

Use filenames stored in a database to display images in C#

The reason so many people ask how to store and retrieve images in a database is that it’s hard. You need to use a special data type such as the BLOB (Binary Large Object) or MEMO data type depending on … Continue reading

Posted in database, graphics, image processing, user interface | Tagged , , , , , , , , , , , , , , | 2 Comments