ex.hlp (Topic list)
ADDITEM and REMOVEITEM Methods Example
                        Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
' The example uses the ADDITEM method to add 100 items to a list box. the
' REMOVEITEM method is used to remove items from the list box control.
'
' To try this example:
' 1. Choose New Project from the File menu
' 2. Choose New Form from the File menu to create a form with a list box
'    control
' 3. Press Alt+F4 to return to the programming environment
' 4. Copy the code example below to the form module
' 5. Press F5 to run the example
 
 DECLARE SUB AddRemItemDemo ()
 DIM SHARED X%
 
 SUB AddRemItemDemo ()
         SELECT CASE X%
     CASE 1
          Msg$ = "Choose OK to add 100 items to your list box."
          MSGBOX Msg$                      ' Display message
          FOR I% = 1 TO 100                ' Count from 1 to 100
               Entry$ = "Entry " + STR$(I%)' Create entry
               List1.ADDITEM Entry$        ' Add the entry
          NEXT I%
     CASE 2
          Msg$ = "Choose OK to remove every other entry."
          MSGBOX Msg$                      ' Display message
          FOR I% = 1 TO 50                 ' Determine how to
               List1.REMOVEITEM I%         ' remove every other
          NEXT I%                          ' item
     CASE 3
          Msg$ = "Choose OK to remove all items from the list box."
          MSGBOX Msg$                      ' Display message
          DO WHILE List1.ListCount         ' As long as there are
               List1.REMOVEITEM 0          ' still items in the
          LOOP                             ' list box, remove them
     END SELECT
 END SUB
 
 SUB Form_Click ()
         X% = X% + 1
         CALL AddRemItemDemo
         IF X% = 3 THEN X% = 0
 END SUB