home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0210 - 0219 / ibm0210-0219 / ibm0213.tar / ibm0213 / PWA_AWAR.ZIP / SAMPVB.Z / NOTEFILE.BAS < prev    next >
Encoding:
BASIC Source File  |  1994-07-05  |  1.6 KB  |  75 lines

  1. ' Copyright (C) 1993-94, FarPoint Technologies
  2. '
  3. ' You have a royalty-free right to use, modify, reproduce and distribute
  4. ' the Sample Aware/VBX Application Files (and/or any modified version) in 
  5. ' any way you find useful, provided that you agree that FarPoint has no 
  6. ' warranty, obligation or liability for any Aware/VBX Application File.
  7.  
  8. Global gMemoChanged As Integer  ' track when contents are changed
  9. Global gFileName As String      ' remember last filename
  10.  
  11. Sub LoadFile (fpmemo As Control, FileName As String)
  12. '
  13. ' Load text file into AwareMemo control using "block mode".
  14. '
  15.  
  16.     Dim total As Long
  17.     Dim n As Long
  18.  
  19.     fpmemo.Visible = False
  20.     
  21.     Open FileName For Input As #1
  22.     
  23.     ' read first block
  24.     '
  25.     fpmemo.TextMode = 1
  26.     total = LOF(1)
  27.     Do While Not EOF(1)
  28.        If total > 32000 Then
  29.           n = 32000
  30.        Else
  31.           n = total
  32.        End If
  33.        char = Input(n, #1)
  34.        fpmemo.Text = char
  35.        
  36.        ' read next block
  37.        '
  38.        fpmemo.TextMode = 2
  39.        total = total - n
  40.     Loop
  41.     Close #1
  42.  
  43.     fpmemo.TextMode = 1
  44.     fpmemo.DataChanged = True
  45.  
  46.     fpmemo.Visible = True
  47.  
  48. End Sub
  49.  
  50. Sub WriteFile (fpmemo As Control, FileName As String)
  51. '
  52. ' Save AwareMemo contents to a text file using "block mode".
  53. '
  54.     Dim s As String
  55.  
  56.     Open FileName For Output As #1
  57.     
  58.     ' first block
  59.     '
  60.     fpmemo.TextMode = 1
  61.     s = fpmemo.Text
  62.     Do While s <> ""
  63.        Print #1, s;
  64.        
  65.        ' next block
  66.        '
  67.        fpmemo.TextMode = 2
  68.        s = fpmemo.Text
  69.     Loop
  70.     Close #1
  71.     fpmemo.TextMode = 1
  72.  
  73. End Sub
  74.  
  75.