Category Archives: controls

Let the user drag ListBox items in C#

This example uses drag-and-drop to allow the user to drag ListBox items from one position to another. To use the program, right-click on an item and then drag it to hits new position. If you drag an item beyond the … Continue reading

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

Let the user arrange ListBox items in C#

This example demonstrates one way that you can let the user arrange ListBox items. To rearrange the items, the user can click on an item and then use the program’s buttons to move the item to the top of the … Continue reading

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

Change a DataGridView entry when the user double-clicks a cell in C#

This post is in response to the following question: Respected Sir, I need help on how can i change the datagridview cell value by double click on that cell. Let say cell contain value ‘N’ when i double click it … Continue reading

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

Let the user drag pictures in a picture list in C#

The post Improve the picture list in C# showed how you can let the user add, remove ,and rearrange images in a picture list. To rearrange the list, the user right-clicks on a picture and selects Move Left or Move … Continue reading

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

Improve the picture list in C#

My post Make a picture list in C# explained how you can make a picture list that lets the user add, remove, and rearrange pictures. This post adds a small improvement. The previous example displayed images in PictureBox controls with … Continue reading

Posted in controls, lists, user interface | Tagged , , , , , , , , | 1 Comment

Make a picture list in C#

This example shows how to build a picture list that lets the user add, remove, and rearrange pictures at run time. If you right-click between two pictures or to the left or right of all of the pictures, the program … Continue reading

Posted in controls, lists, user interface | Tagged , , , , , , , , | 1 Comment

Load Excel records into a DataGridView in C#

This example shows how you can load Excel records into a DataGridView control. You can use similar techniques to load Excel data into other controls such as other kinds of grid controls or a TreeView control. This example uses the … Continue reading

Posted in controls, database, Excel, interoperability | Tagged , , , , , , , , , , , , | 4 Comments

Use a standard Windows dialog to let the user select folders in C#

The .NET OpenFileDialog and SaveFileDialog are fairly full-featured. They’re a lot like Windows Explorer with some added file selection capabilities thrown in. In contrast, the FolderBrowserDialog is pretty pathetic. It only lets you use a hierarchical tree-like display, doesn’t provide … Continue reading

Posted in API, controls, files | Tagged , , , , , , , , , , , , , , , , | 13 Comments

Make a custom component in C#

There are a couple of ways that you can approach this problem. In this post, I’ll describe two: subclassing from Component and making a control that is invisible at runtime. Subclassing From Component To make a true component, simply make … Continue reading

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

Display a progress bar with text in WPF and C#

As is so often the case in WPF, the solution is simple after you spend a few hours figuring out what controls to use. This example uses a normal Grid control that holds a StackPanel. The following code shows the … Continue reading

Posted in controls, user interface, wpf, XAML | Tagged , , , , , , , , , , , , , | 1 Comment