SpeakComputers.com
Home
Software
Electronics
Desktop Computers
Laptops
Games
Handheld Devices
Mobile Phones
Cameras
Camcorders
Printers
Books
Software Downloads 2012 Software Mac Software Security Student Editions Windows 7 Office 2010
ASP.NET C# VB.NET C++ .NET Infragistics DevComponents

ListBox Control.

The System.Windows.Forms.ListBox control enabled you to display a list of items from which the user can select one or multiple items from the list. The default is for the ListBox to list the items vertically however setting the multicolumn property to true the items are listed horizontally. The control is typically used to display data from a database. The items listed within the ListBox cannot be edited directly.


Namespace: System.Windows.Forms
Assembly: Systems.Windows.Forms.dll

using System.Windows.Forms;
Calling: System.Windows.Forms.ListBox


Creating a new System.Windows.Forms.ListBox control.
ListBox listBox1 = new ListBox();

Adding the ListBox control to a Windows form.
this.Controls.Add(listBox1);

Placing the ListBox on the form at a specific location.
listBox1.Location = new Point(50, 50);

Assigning a text value to a ListBox control.
listBox1.Text = "Enter";

Assigning a listBox1_SelectedIndexChanged event to the button control.
listBox1.SelectedIndexChanged+=new EventHandler(listBox1_SelectedIndexChanged);

Responding to the ListBox SelectedIndexChanged event.
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
//The MessageBox is part of the System.Windows.Forms namespace.
MessageBox.Show(listBox1.SelectedItem.ToString());
}

Changing the background color of the ListBox control.
listBox1.BackColor = System.Drawing.Color.Red;

To disable the button control.
listBox1.Enabled = false;
Here the ListBox control is still visible (partially faded) but will not respond to any events. To re-enable the ListBox control you would set the Enabled property to true. When adding the ListBox control the default setting is for the control to be Enabled.

With the ListBox control, you can add many different types of objects or classes. The control can be bound to a data source to present data from a database to the end user.

The Infragistics control set does not include the listbox control. You can sort of use the UltraTree view control and set the boolean property FullRowSelect to true. This will only give you the look of the ListBox control but you do not have the important control events.

Rather use the System.Windows.Forms.ListBox or another .net third party control.
Computer Security
AntiVirus Software
Internet Security
Parental Controls
Backup & Recovery
Computer Protection
Anti Malware
Photo & Video
Photo & Video Editing
Video Music
Desktop Publishing
Professional Design
Home Publishing
Clipart
Business & Accounting
Accounting
Payroll
Check Printing
TAX
H&R Block
Microsoft Office
Design
Graphic Design
Home Design
Garden Design
Interior Design
Computer Aided Design
3D Design
Students & Teacher
Adobe
Microsoft Office
Dragon Naturally Speaking
Corel Draw
Serif
Student/Teacher Software
Copy Right 2006 SpeakComputers.com - All Rights Reserved.
Home About Privacy Policy Resouces