Article ID: 110185
Article Last Modified on 10/30/2003
APPLIES TO
- Microsoft Visual Basic 3.0 Professional Edition
- Microsoft Visual Basic 3.0 Professional Edition
This article was previously published under Q110185
SYMPTOMS
The 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.
CAUSE
This behavior occurs when the length of the Open dialog string containing
the file names exceeds 256, the default MaxFileSize property value.
RESOLUTION
To resolve the problem, increase the MaxFileSize property to 2048:
CMDialog1.MaxFileSize = 2048
2048 is the maximum string size for the Common Dialog File-Open box. 256 is
the default.
STATUS
This behavior is by design.
REFERENCES
The following corrections apply to the "Language Reference":
- On page 363 for the MaxFileSize property, change the "Applies to:"
section to read "Common dialog (file dialogs)." Also say that the
maximum MaxFileSize property value is 2048.
- On page 89, add MaxFileSize and FilterIndex to the Common Dialog
Control "Properties (File Dialogs)" section.
Additional query words: 3.00
Keywords: kbprb KB110185