0% found this document useful (0 votes)
11 views

Lecture Four For Windows Programming

The document discusses the ListBox control in Windows forms, including how to add one to a form and set its properties like width, visible, and selection mode. It also covers common ListBox methods like Add(), Remove(), Clear(), Contains(), and Sort().

Uploaded by

David Ezekiel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Lecture Four For Windows Programming

The document discusses the ListBox control in Windows forms, including how to add one to a form and set its properties like width, visible, and selection mode. It also covers common ListBox methods like Add(), Remove(), Clear(), Contains(), and Sort().

Uploaded by

David Ezekiel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

LISTBOX CONTROL 1

The ListBox control is used to display a list of items in Windows form. It allows
the user to select one or more items from the ListBox Control. Furthermore, we
can add or design the list box by using the properties and events window at
runtime.
Let's create a ListBox control in the VB.NET Windows by using the following
steps.
LISTBOX CONTROL
2
Step 1: Drag the ListBox control from the Toolbox and drop it to the Windows
form, as shown below.

Step 2: Once the ListBox is added to the Form, we can set various properties of the Listbox by clicking on the
ListBox control.
ListBox Properties 3
PROPERTIES NAME DESCRIPTION

AllowSelection It takes a value that defines whether the list box allows the user to select the item
from the list.
CanSelect It obtains a value that determines whether the Listbox control can be selected.

ColumnWidth It is used to get or set the width of the columns in a multicolumn Listbox.

Container As the name defines, a container gets the IContainer that stores the component of
ListBox control.
Controls It is used to get the collection of controls contained within the control.

Created It takes a value that determines whether the control is created or not.

Width It is used to set the width of the ListBox control.


ListBox Properties 4

PROPERTIES NAME DESCRIPTION

Visible It takes a value that determines whether the ListBox control and all its child are
displayed on the Windows Form.
SelectionMode It is used to get or set the method that determines which items are selected in the
ListBox.
MultiColumn It allows multiple columns of the item to be displayed by setting the True value in
the Listbox.
ListBox Methods 5

Method Name Description

Add() The Add() method is used to add items to an item collection.

Remove It is used to remove an item from an item collection. However, we can remove
items using the item name.

Clear It is used to remove all items from the item collection at the same time.

Contains It is used to check whether the particular item exists in the ListBox or not.

Show() It is used to display the control to the user.


ListBox Methods 6

Method Name Description

Sort() As the name suggests, a Sort() method is used to arrange or sort the elements
in the ListBox.

ResetText() A ResetText() method is used to reset ListBox's text property and set the
default value.

ResetBackColor() It is used to reset the backColor property of the ListBox and set the default
value.

OnNotifyMessage It is used to notify the message of the ListBox to Windows.

GetSelected The GetSelected method is used to validate whether the specified item is
selected.
LISTBOX 7

Let's create a program to select an item from the ListBox in the VB.NET
form.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy