Home > Language Reference > Classes > ChoiceControl

Change Event

Event raised when a new item is selected in the list.

Syntax

Public Event Change()

Remarks

The Change event is raised when the user selects a new element in the list displayed by the control.

From its event handler, you can determine the element selected by consulting the value of the ListIndex property. You can also determine the heading or associated value of this element using the List and ItemData properties.

The following example fills a list with the digits 0 to 9, and displays a message box when the user selects an element:

Private Sub Form_Load()
  Dim i as Integer

  List1.Redraw = False
  For i = 0 To 9
    List1.AddItem "Item #" & CStr(i), i
  Next i
  List1.Redraw = True
End Sub

Private Sub List1_Change()
  Dim k as Integer

  k = List1.ListIndex
  If k>=0 Then
    MsgBox "Selected Item : " & List1.ItemData(k)
  Else
    MsgBox "No selection"
  End If
End Sub

Note: this event is not raised when the selection is programmatically modified with the ListIndex property.

System requirements

SystemMinimal versionRemarks
Palm OSPalm OS 3.0N/A