Knowledge Base |

# PC Forms: Working with Multiple-Selection List Boxes

Article ID: 119562

Article Last Modified on 10/30/2006

APPLIES TO

- Microsoft Mail for PC Networks 3.0
- Microsoft Mail for PC Networks 3.2
- Microsoft Exchange Electronic Forms Designer 5.0

This article was previously published under Q119562
1.00 WINDOWS kbprg

## SYMPTOMS

When you create a custom form using Microsoft Electronic Forms Designer, the selected items in a multiple-selection list box are not automatically written to the electronic form (E-form) package. Therefore, the selected lines do not appear in the list box on the Read form.

## MORE INFORMATION

The WriteTaggedControls function does not include code to automatically package a multiple-selection list box. You can, however, add code to the WriteMessage and ReadMessage functions so the selected items in a multiple- selection list box are transferred to the Read form.
The following example shows the code that should be added to each function.

1. Add the following code to the WriteMessage function in the EFORM.BAS file. Note the comments that describe the various steps.

       'Declare the variables
          Dim n As Integer
          Dim theText As String
          Dim theTotal As Long

          'Process the list, writing each item to the package using a unique
          'itemID,
           ("List0". "List1", etc.)
          theTotal = 0
          For n = 0 To (frmCompose.lstColor.ListCount - 1)
             If frmCompose.lstColor.Selected(n) = True Then
               theText = frmCompose.List1.List(n)
               MEFWriteText gPackage, "List" &amp; Str$(theTotal), theText
               theTotal = theTotal + 1
             End If
          Next

          'Write the number of items to the package
          MEFWriteLong gPackage, "theTotal", theTotal

2. Add the following code to the ReadMessage function to unpackage the data:

       'Declare variables
          Dim n As Integer
          Dim theTotal As Long

          'Find the number of items in the list by reading the package.
          theTotal = MEFReadLong(gPackage, "theTotal", 0)

          'Read in each of the items and add it to the list using AddItem
          For n = 0 To theTotal
             frmRead.lstColor.AddItem MEFReadText(gPackage, "List" &amp; Str$(n), "")
          Next

Additional query words: 1.00 e-forms eforms multiple selection list box multiselect

Keywords: KB119562