Dialogs and Message Boxes in VB6: Difference between revisions
Jump to navigation
Jump to search
New page: * The FileOpen method calls VBGetOpenFileName, which calls Windows GetOpenFileName. * The FileSaveAs method calls VBGetSaveFileName, which calls Windows GetSaveFileName. * The FilePrint me... |
mNo edit summary |
||
| Line 30: | Line 30: | ||
End If | End If | ||
End Function | End Function | ||
Pass the result to the LoadFile method. | |||
| |||
| | ||
Revision as of 17:30, 29 January 2008
- The FileOpen method calls VBGetOpenFileName, which calls Windows GetOpenFileName.
- The FileSaveAs method calls VBGetSaveFileName, which calls Windows GetSaveFileName.
- The FilePrint method calls VBPrintDlg, which calls Windows PrintDlg.
- The FilePageSetup method calls VBPageSetupDlg, which calls Windows PageSetupDlg.
- The OptionFont method calls VBChooseFont, which calls Windows ChooseFont.
- The OptionColor method calls VBChooseColor, which calls Windows ChooseColor.
Private Sub mnuFileOpen_Click() If edit.DirtyDialog Then edit.FileOpen dropFile.Text = edit.filename SetTextMode edit.TextMode End Sub
After checking that the current file is saved, call the FileOpen method of the XEditor object. FileOpen in turn calls VBGetOpenFileName:
Function FileOpen() As Boolean
Dim f As Boolean, sFile As String, fReadOnly As Boolean
f = VBGetOpenFileName( _
FileName:=sFile, _
ReadOnly:=fReadOnly, _
Filter:=FilterString, _
Owner:=hWnd)
If f And sFile <> sEmpty Then
TextMode = Not IsRTF(sFile)
LoadFile sFile
If fReadOnly Then Locked = True
FileOpen = True
End If
End Function
Pass the result to the LoadFile method.