home *** CD-ROM | disk | FTP | other *** search
- ' Copyright (C) 1993-94, FarPoint Technologies
- '
- ' You have a royalty-free right to use, modify, reproduce and distribute
- ' the Sample Aware/VBX Application Files (and/or any modified version) in
- ' any way you find useful, provided that you agree that FarPoint has no
- ' warranty, obligation or liability for any Aware/VBX Application File.
-
- Global gMemoChanged As Integer ' track when contents are changed
- Global gFileName As String ' remember last filename
-
- Sub LoadFile (fpmemo As Control, FileName As String)
- '
- ' Load text file into AwareMemo control using "block mode".
- '
-
- Dim total As Long
- Dim n As Long
-
- fpmemo.Visible = False
-
- Open FileName For Input As #1
-
- ' read first block
- '
- fpmemo.TextMode = 1
- total = LOF(1)
- Do While Not EOF(1)
- If total > 32000 Then
- n = 32000
- Else
- n = total
- End If
- char = Input(n, #1)
- fpmemo.Text = char
-
- ' read next block
- '
- fpmemo.TextMode = 2
- total = total - n
- Loop
- Close #1
-
- fpmemo.TextMode = 1
- fpmemo.DataChanged = True
-
- fpmemo.Visible = True
-
- End Sub
-
- Sub WriteFile (fpmemo As Control, FileName As String)
- '
- ' Save AwareMemo contents to a text file using "block mode".
- '
- Dim s As String
-
- Open FileName For Output As #1
-
- ' first block
- '
- fpmemo.TextMode = 1
- s = fpmemo.Text
- Do While s <> ""
- Print #1, s;
-
- ' next block
- '
- fpmemo.TextMode = 2
- s = fpmemo.Text
- Loop
- Close #1
- fpmemo.TextMode = 1
-
- End Sub
-
-