Sub btn_ConvertDB_Click () 'Tell him about the Database Conversion Load ConvForm ConvForm.Show 1 'modal - has to exit to continue End Sub Sub btn_How_Click () 'Tell him what Flopycat is Load HowForm HowForm.Show 1 'modal - has to exit to continue End Sub Sub btn_Okay_Click () Dim msgstring As String Dim i As Integer 'if we came here from the active application, don't restart it If ABOUT_FLG = 1 Then 'just leave now Unload AboutFrm Exit Sub End If NO_DESC = "***No Description" NO_ENTRY = "***No Entry Found" screen.MousePointer = HOURGLASS Unload AboutFrm 'finished - unload the form 'prepare current location of FLOPYCAT database DEL_RECD = 0 'assume no entries will be deleted FILERECCOUNT = 0 'in case file(s) not found DB_PATH = CurDir 'see if FLOPYCAT db is in prod'n spot 'if the current path is the VisBasic development account, then If DB_PATH = "C:\VB" Then 'I am running it in development mode, so point to my test database DB_PATH = "C:\FLOPYCAT\VERS2-1\DATASETS" End If 'Version 2 does not use Microsoft Access, but uses my own system 'of index/datafiles. The four files in use are: ' FLOPYCAT.I1 - The index to all the filename entries in the catalog ' FLOPYCAT.D1 - The actual filename entries in the catalog ' FLOPYCAT.I2 - The index to all the disks in the catalog ' FLOPYCAT.D2 - The actual disk entries in the catalog FILEINDEXNAME = DB_PATH & "\FLOPYCAT.I1" 'FILES Index File Name FILERECORDNAME = DB_PATH & "\FLOPYCAT.D1" 'FILES Data File Name FILERECORDBACK = DB_PATH & "\FLOPYCAT.BAK" 'FILES Data File Name DISKINDEXNAME = DB_PATH & "\FLOPYCAT.I2" 'DISKS Index File Name DISKRECORDNAME = DB_PATH & "\FLOPYCAT.D2" 'DISKS Data File Name Load FCatMain 'load the main form 'try to access the db before we start, to see if it is there OpenMaster: On Error GoTo No_Master 'in case Master File is not there 'Try to open the FileNames data and index files. If they are 'not there, the OPEN will create zero-length versions of the file Open FILERECORDNAME For Random As #1 Len = Len(FILEREC) FILERECCOUNT = LOF(1) / Len(FILEREC) 'calc # of records in file Close #1 'close the Master File 'NOTE: FileRecCount will be zero when datafile is just created 'If that is the case, don't bother trying to either REDIM the array or 'OPEN the INDEX file 'First open the index file for input, read all the index 'entries, load them into the in-core array, and then 'close the file On Error GoTo No_Index 'in case no Index file found If FILERECCOUNT > 0 Then 'if we have a master file, then 'set in-core array size to current size 'of master file, PLUS enough entries to 'bring it to the next multiple of 50 ReDim FILENDX(FILERECCOUNT + (50 - (FILERECCOUNT Mod 50))) 'set array to hold all index rcds Open FILEINDEXNAME For Input As #2 On Error GoTo End_Index 'in case premature EOF found For i% = 1 To FILERECCOUNT 'read that many entries Input #2, FILENDX(i%).fnx_ident, FILENDX(i%).fnx_Recnum 'save id + master entry num Next i% Close #2 'close it now - don't need it until later End If No_Index: 'If there is no Index file, it doesn't matter because the first time we 'do a Save_Screen, all entries on the screen will show 'No Entry Found 'in Database, and an Index entry will be created for each one On Error GoTo 0 'all done with error checking now FILENDXCOUNT = FILERECCOUNT 'that many in the array GoTo Carry_On: End_Index: 'if we get here, there were less index entries than there were master 'entries, which means that some master entries were "==DELETED==" but 'still on the Master file, with no corresponding index files. The loop 'control i% has the correct number of index entries, so we need to save it FILENDXCOUNT = i% - 1 'we went too far by one Close #2 'close it now - don't need it until later Carry_On: On Error GoTo 0 'Datafiles there okay - turn off error trap FCatMain.Show 0 'non-modal so it can be left displayed screen.MousePointer = DEFAULT ABOUT_FLG = 1 'remember we are active now Exit Sub No_Master: 'If there is no Master file, it doesn't matter because the first time we 'do a Save_Screen, all entries on the screen will be written to a new 'Master file, which we will create then Resume Carry_On 'If there was no Master file, there is no 'point in trying to open the Index file, 'because even if it is there, it won't relate 'to anything End Sub Sub btn_Register_Click () 'Tell him how to register Load RegrWho RegrWho.Show 1 'modal - has to exit to continue End Sub Sub btn_Share_Click () 'Tell him what ShareWare is Load SharForm SharForm.Show 1 'modal - has to exit to continue End Sub Sub btn_What_Click () 'Tell him what Flopycat is Load WhatForm WhatForm.Show 1 'modal - has to exit to continue End Sub Sub Form_Load () Dim d% 'Center form Left = (screen.Width - Width) / 2 Top = (screen.Height - Height) / 2 NL$ = Chr$(13) + Chr$(10) ' Set up NL & BAD_DRIVE = 0 'init this switch End Sub Sub mnuHelpTop_Click () 'if we came here from the active application, don't end app'n If ABOUT_FLG = 1 Then 'just leave now Unload AboutFrm Exit Sub Else 'we are at the beginning, and we doesn't want to play End End If End Sub