PC Forms: Working with Multiple-Selection List Boxes

Last reviewed: October 25, 1994
Article ID: Q119562
The information in this article applies to:
  • Microsoft Electronic Forms Designer, version 1.0, running with Microsoft Mail for PC Networks, version 3.0 or 3.2

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" & 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" & Str$(n), "")
       Next
    


Additional reference words: 1.00 e-forms eforms multiple selection list box
multiselect list box
KBCategory: kbprg
KBSubcategory: MailPCForms


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 25, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.