PRB: Common Dialog Open: Err=20476 Buffer lpstrFile Too SmallLast reviewed: February 18, 1996Article ID: Q110185 |
The information in this article applies to:
- Standard and Professional Editions of Microsoft Visual Basic for Windows, version 3.0
SYMPTOMSThe following behavior occurs with the Open file dialog box of the Common Dialog custom control when you set the Flags property to &H200& or OFN_ALLOWMULTISELECT, to allow selection of more than one file at once. If you highlight more than about 20 files at once in the Open file dialog box, the following error message displays when you click the OK button:
The buffer at which the member lpstrFile points is too small.Or, if error trapping is on, the Err function reports error number 20476. In the Visual Basic environment, if you press F5 or choose Continue from the Run menu after getting this error, you get the following error message:
Invalid filename. CAUSEThis behavior occurs when the length of the Open dialog string containing the file names exceeds 256, the default MaxFileSize property value.
RESOLUTIONTo resolve the problem, increase the MaxFileSize property to 2048:
CMDialog1.MaxFileSize = 20482048 is the maximum string size for the Common Dialog File-Open box. 256 is the default.
STATUSThis behavior is by design.
MORE INFORMATIONYou can set the Flags property of the Common Dialog to &H200&, or OFN_ALLOWMULTISELECT, to allow multiple selections in the File Name list box. You can select more than one file at run time by pressing the SHIFT key and using the UP and DOWN ARROW keys to select the desired files. The FileName property returns a string containing the names of all selected files. The names in the string are delimited by spaces.
Steps to Reproduce Behavior
REFERENCESThe following corrections apply to the "Language Reference":
|
Additional reference words: 3.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |