home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "Form1"
- ClientHeight = 2775
- ClientLeft = 3165
- ClientTop = 3810
- ClientWidth = 6690
- Height = 3180
- Left = 3105
- LinkTopic = "Form1"
- ScaleHeight = 2775
- ScaleWidth = 6690
- Top = 3465
- Width = 6810
- Begin VB.TextBox Text2
- Height = 495
- Left = 2160
- TabIndex = 3
- Text = "Text2"
- Top = 2160
- Width = 3375
- End
- Begin VB.TextBox Text1
- Height = 495
- Left = 2160
- TabIndex = 2
- Text = "Text1"
- Top = 1440
- Width = 3495
- End
- Begin VB.CommandButton Command2
- Caption = "Command2"
- Height = 495
- Left = 120
- TabIndex = 1
- Top = 720
- Width = 1215
- End
- Begin VB.CommandButton Command1
- Caption = "Command1"
- Height = 495
- Left = 120
- TabIndex = 0
- Top = 120
- Width = 1215
- End
- Begin VB.Label Label1
- Caption = "Name"
- Height = 495
- Left = 720
- TabIndex = 5
- Top = 2160
- Width = 1215
- End
- Begin VB.Label ID
- Caption = "ID Number"
- Height = 375
- Left = 720
- TabIndex = 4
- Top = 1440
- Width = 1215
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Private Type Record
- ID As String * 3
- Name As String * 20
- End Type
- Dim MyRecord As Record
- Dim recIdx As Long
- Dim recBuf As String * 100
- Dim F As New COMPRESSION
- Private Sub Command1_Click()
- Dim idx As Long
- F.fileName = "testfile.dat"
- Open F.fileName For Random As #1 Len = Len(MyRecord)
- For idx = 0 To 25
- MyRecord.ID = CStr(idx) + 1
- MyRecord.Name = "*" & String(18, idx + Asc("A")) & "*"
- Put #1, , MyRecord
- Next idx
- Close #1
- F.compress
- MsgBox "textfile.dat has been compressed...Go Look! Then click OK."
- Kill "testfile.dat"
- MsgBox "testfile.dat has been deleted...Go Look! Then click OK."
- F.expand
- MsgBox "textfile.da_ has been expanded...Go Look! Then click OK."
- Command1.Enabled = False
- Command2.Enabled = True
- readRec
- End Sub
- Private Sub Command2_Click()
- If recIdx > 26 Then recIdx = 1
- readRec
- End Sub
- Private Sub Form_Load()
- Command1.Caption = "Create TestFile"
- Command2.Caption = "Next Record"
- Command2.Enabled = False
- recIdx = 1
- End Sub
- Private Sub readRec()
- F.read recIdx, Len(MyRecord), recBuf
- MyRecord.ID = Left(recBuf, 3)
- MyRecord.Name = Mid(recBuf, 4)
- Text1.TEXT = MyRecord.ID
- Text2.TEXT = MyRecord.Name
- recIdx = recIdx + 1
- End Sub
-