Click here to Skip to main content
15,867,686 members
Articles / Programming Languages / C#

An Extended ListBox Control

Rate me:
Please Sign up or sign in to vote.
3.78/5 (9 votes)
17 Dec 20021 min read 129.4K   1.3K   44   6
A control that offers extensible entry specification and full keyboard support

Sample Image - ListBoxEx.jpg

Introduction

This control is a .NET version of the extended ListBox editor that originally showed up in Visual Studio. The control offers an extensible interface for specifying ordered entries of data items in string format. The control uses a button at the end of each line in the list, to allow the user a custom interface for specifying the text for that entry.

In addition to the GUI, the control offers full keyboard support for specifying entries in the list.

INSERT Creates a new item at the end of the list
DELETE Deletes the currently selected item
CTRL+UP ARROW Moves the selected item up in the list
CTRL+DOWN ARROW Moves the selected item down in the list
ENTER Calls to the IBrowser interface to allow the user to specify a value

The namespace defines an interface IBrowser that allows a programmer to extensibly specify how to obtain the value for the selected entry. With this interface, a programmer could specify any type of interface for configuration data. As long as the data can be represented as a string, the configuration data can be ordered by this control.

C#
public interface IBrowser
{
    string Value
    {
        get;
        set;
    }
}

The control comes with a simple IBrowser implementation called OpenFileBrowser. This implementation simply creates the OpenFileDialog object and allows the user to specify a particular file. The genesis for the control was to have a base control to use, for specifying lists of IP Address specifications/ranges.

License

This article has no explicit license attached to it, but may contain usage terms in the article text or the download files themselves. If in doubt, please contact the author via the discussion board below. A list of licenses authors might use can be found here.


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionCan I use your project in my project? Pin
weiqj27-Jul-06 8:10
weiqj27-Jul-06 8:10 
AnswerRe: Can I use your project in my project? Pin
HankiDesign6-Jul-07 7:56
HankiDesign6-Jul-07 7:56 
NewsAdvanced list box and combo box Pin
brett5630-Nov-05 5:56
brett5630-Nov-05 5:56 
Like many who use The Code Project we've spent countless hours building custom controls to meet our needs. Unfortunately, it's hard to justify spending thousands of hours on a custom control unless you intend to market them.

We've just released a beta of List Controls for .NET WinForms which includes the most advanced list box and combo box controls ever built for any platform.

Sounds too good to be true? Please, confirm this statement for yourself. A beta of List Controls is available for download from our website, including a comprehensive demo and tutorial.

http://www.it-partners.com/products/list_controls_win_forms/list_controls.asp[^]

Many features, too many to list here!

Brett Werner
it-partners.com
General... but it does not inherit from ListBox Pin
Peter Smartt25-Nov-03 12:27
Peter Smartt25-Nov-03 12:27 
GeneralRe: ... but it does not inherit from ListBox Pin
Maciek Plewa10-Mar-04 4:42
sussMaciek Plewa10-Mar-04 4:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.