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

C++ ListBox Control.

The C++ System.Windows.Forms.ListBox control enables 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
System.Windows.Forms (in system.windows.forms.dll)

Creating an new C++ Windows forms ListBox.
ListBox^ listbox = gcnew ListBox;

Assigning a new location for the C++ Windows Forms ListBox.
listbox->Location = Point(40,40);

Assigning a Selection Mode value to the C++ ListBox control.
listbox->SelectionMode = System::Windows::Forms::SelectionMode::MultiExtended;

Adding a C++ ListBox control to the form.
Controls->Add(listbox);

Adding items to the C++ ListBox control.
String^ str = "DELL";
String^ str2 = "HP";
String^ str3 = "SONY";
listbox->Items->AddRange(gcnew cli::array<System::String^ >(3) {str, str2, str3});

Creating a Selected Index Changed Event for the C++ ListBox control.
this->listbox->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::listbox_SelectedIndexChanged);

Responding to the C++ ListBox Selected Index Changed event.
private: System::Void listbox_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e)
{
MessageBox::Show(listbox->SelectedItem->ToString());
}

C++ ListBox control Tutorial.
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