Common Dialog Control: Pipe (|) Optional in Filter Property

Last reviewed: June 21, 1995
Article ID: Q80935
The information in this article applies to:

- Professional Edition of Microsoft Visual Basic for Windows, versions

  2.0 and 3.0
- Microsoft Professional Toolkit for Microsoft Visual Basic programming
  system for Windows, version 1.0

SUMMARY

The pipe character (|), which is placed at the end of each selection in the Filter property of the Common Dialog custom control, is optional on the last item in the string.

This information applies to the Common Dialog custom control supplied with Microsoft Professional Toolkit for Microsoft Visual Basic programming system version 1.0 for Windows and with the Professional Edition of Visual Basic version 2.0 for Windows.

MORE INFORMATION

Filter is a property of the Common Dialog custom control (COMMDLG.DLL). The Filter property is assigned a string that contains sets of "description" and "filter". Each set represents one entry in the List Files of Type list box.

Each of these items in the string are followed by a pipe character (|). The last item in the list need not be followed by a pipe, although it is allowed.

The syntax for using the Filter property is as follows:

   CommonDialog.Filter[= desc1$|filter1$|desc2$|filter2$]

Either of the following code examples will work:

   CMDialog1.Filter = "Text Files (*.txt)|*.txt"

   -or-

   CMDialog1.Filter = "Text Files (*.txt)|*.txt|"

The Microsoft Visual Basic Professional Toolkit documentation uses both of these methods in its code examples.


Additional reference words: 1.00 2.00 3.00
KBCategory: kbprg
KBSubcategory: PrgCtrlsStd


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: June 21, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.