Você está na página 1de 41

Electro-Team

Interesting Education

electroteam__@hotmail.com

ListBox & CheckedListBox

DialogBox

Display Toolbox

Add 2 Buttons & 1 ListBox

Display Properties Window

Select item property of ListBox

Add items of ListBox

Press ok to precede

Rename Form1 by changing Text property

Change Font property for all controls

Event
Button_Click

Changing Form1.BackColor

Double click Button1

Event
ListBox1_SelectedIndexChanged

Changing Form1.BackColor

Double click ListBox1

Add ListBox2

Change Text Property of Button1

Event
Button_Click

Copy Item from ListBox1 to ListBox2

Event
Button_Click

Moving Item from ListBox1 to ListBox2

Clear all Items

Event
Button_Click

Edit selected Item

Event
Button_Click

Error
ListBox1.Items(ListBox1.SelectedIndex) = TextBox1.Text ListBox1.Items
White Red Black yellow

ListBox1.SelectedIndex
0 1 2 3

No selection made mean ListBox1.SelectedIndex = -1 , this

value will produce an Error.

Copy selected Item to Textbox

Event
ListBox1_SelectedIndexChanged

Replace ListBox by CheckedListBox

Event
Button_Click

Get all items in message box

Code illustration
Dim X As New System.Text.StringBuilder For I = 0 To 3 X.Append(CheckedListBox1.Items(I)) X.Append(" ") Next MessageBox.Show(X.ToString())
System.Text StringBuilder NameSpace Class

Append(item)
ToString

Append (String)
Method

Modify Last Code


Dim X As New System.Text.StringBuilder For Each item In CheckedListBox1.Items X.Append(item) X.Append(" ") items spaces

Next
MessageBox.Show(X.ToString())
System.Text StringBuilder Items Append(item) NameSpace Class Property Append (String)

ToString

Method

Code illustration
NameSpace Class Property Append (String) container for a set of identifiers (names) A set of instance information for a real content. Property Appends a copy of the specified string to this instance. convert the StringBuilder object to a String object before you can pass the string represented by the StringBuilder object to the user interface.

ToString (Method)

Você também pode gostar