home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
- Begin VB.MDIForm MDIForm1
- AutoShowChildren= 0 'False
- BackColor = &H8000000C&
- Caption = "MDIEditor"
- ClientHeight = 4905
- ClientLeft = 165
- ClientTop = 735
- ClientWidth = 6840
- LinkTopic = "MDIForm1"
- StartUpPosition = 3 'Windows Default
- Begin MSComDlg.CommonDialog CommonDialog1
- Left = 5550
- Top = 360
- _ExtentX = 847
- _ExtentY = 847
- _Version = 393216
- FontSize = 1.17491e-38
- End
- Begin VB.Menu MDIFileMenu
- Caption = "File"
- Begin VB.Menu MDINew
- Caption = "New Document"
- End
- Begin VB.Menu MDIOpen
- Caption = "Open Document"
- End
- Begin VB.Menu MDIExit
- Caption = "Exit"
- End
- End
- Attribute VB_Name = "MDIForm1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Function FindFree() As Integer
- Dim i As Integer
- For i = 0 To 9
- If DocumentForms(i).Tag = "" Then
- FindFree = i
- Exit Function
- End If
- Next
- End Function
- Private Sub MDIExit_Click()
- End
- End Sub
- Public Sub MDINew_Click()
- Dim windex As Integer
- windex = FindFree()
- If windex = -1 Then
- MsgBox "You must close one of the documents before another one can be opened"
- Exit Sub
- End If
- Load DocumentForms(windex)
- DocumentForms(windex).Caption = "New Document"
- DocumentForms(windex).Tag = windex
- DocumentForms(windex).Show
- currentDocument = windex
- End Sub
- Public Sub MDIOpen_Click()
- Dim FNum As Integer
- Dim txt As String
- Dim windex As Integer
- windex = FindFree()
- If windex = -1 Then
- MsgBox "You must close one of the documents before another one can be opened"
- Exit Sub
- End If
- Load DocumentForms(windex)
- DocumentForms(windex).Show
- currentDocument = windex
- On Error GoTo FileError
- CommonDialog1.CancelError = True
- CommonDialog1.Flags = cdlOFNFileMustExist
- CommonDialog1.DefaultExt = "TXT"
- CommonDialog1.Filter = "Text files|*.TXT|All files|*.*"
- CommonDialog1.ShowOpen
- FNum = FreeFile
- Open CommonDialog1.FileName For Input As #1
- txt = Input(LOF(FNum), #FNum)
- Close #FNum
- DocumentForms(currentDocument).Editor.Text = txt
- OpenFiles(currentDocument) = CommonDialog1.FileName
- DocumentForms(currentDocument).Tag = OpenFiles(currentDocument)
- DocumentForms(currentDocument).Caption = OpenFiles(currentDocument)
- Exit Sub
- FileError:
- If Err.Number = cdlCancel Then Exit Sub
- MsgBox "Unkown error while opening file " & CommonDialog1.FileName
- OpenFiles(currentDocument) = ""
- End Sub
-