Open/Save File Control

Cost
Free
Version
1

Readme

About

The Open File/Save As Control allows you to open Common Dialog Box with no need to use the Ms Common Dialog Control provided with VB. This Control has the exact same properties as the MS Common Dialog Control. Using this control with save some memory to the user and save you from the need to carry Dialog Boxes that you don’t need.

Installation

In order to install this application, please copy the file to your system directory. Then click Run on your start menu, and enter ‘Regsvr32 OpenSaveFile.cox’. To add the ocx to your project, click Project | Components. Then click browse, and select OpenSaveFile. You will now see the new icon in your toolbox.

This control was compiled with VB6 SP3, if you want to use it in VB5 compile the control from the source code.

You can also use the source code directly in your project by adding the user control file (*.ctl) to your project.

Properties

All properties can be set at both design time and run time.

CancelError - Returns or sets a value indicating whether an error is generated when the user chooses the Cancel button.

DefaultExt - Returns or sets the default filename extension for the dialog box.

DialogTitle - Returns or sets the string displayed in the title bar of the dialog box.

FileName - Returns or sets the path and filename of a selected file.

FileTitle - Returns the name (without the path) of the file to open or save.

Filter - Returns or sets the filters that are displayed in the Type list box of a dialog box. Use the pipe (|) symbol (ASCII 124) to separate the description and filter values. Don't include spaces before or after the pipe symbol, because these spaces will be displayed with the description and filter values.

FilterIndex - Returns or sets a default filter for an Open or Save As dialog box. The index for the first defined filter is 1.

Flags - Returns or sets the options for the Open and Save As dialog boxes. The available flags are part of public Enum enmFlags, Flag names are identical to flags in Common Dialog control but start with ucOF instead of cdlOFN.

InitDir - Returns or sets the initial file directory.

MaxFileSize - Returns or sets the maximum size of the filename opened using the OpenSaveFile control.

Methods

ShowOpen - Displays the OpenFileSave control's Open dialog box.

ShowSave - Displays the OpenFileSave control's Save As dialog box.

Events

(None)

Examples

There is an example project (OpenFile.vbg) included with this control.

Alternatively, you could use the following example code:

  With OpenSaveFile1
.DialogTitle = “Open a Text File”
.Filter = “Text Files (*.txt)|*.txt|All Files (*.*)|*.*”
.FilterIndex = 1
.InitDir = “C:Temp”
.Flags = ucOFHELPBUTTON + ucOFHIDEREADONLY
.ShowOpen
ChoosedFileName = .FileName
ChoosedFileTitle = .FileTitle
End With

Product Support

If you have any problem or like to report any bug, please email [email protected]. Please note that I’ll take no responsibility for any loss, however caused using this control.

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There are only two kinds of languages: the ones people complain about and the ones nobody uses” - Bjarne Stroustrup