Form1 +Program to Sort VB Procedures in .TXT Files Form1% DiskDrv PatternBox QuitBtn &Quit TreeDir FileFlb SortVBfileBtn &Sort VB .TXT file ViewFileBtn &View File PrintFileCom &Print File TextBox DriveLbl Drive: PatternLbl Filename: DirectoryLbl Directory: FilesLbl Files: Form_ClickZ Form_LoadY DateFormatOpt Value> TimeFormat TimeFormatOpt* NowBtn_Click TextBox QuitBtn_ClickV CountryCmb_Change% CountryCmbI ComboItemm VScroll1_Change TimeScl_Changed ScrollBarValueBox TimeSclc ScrollValueBox Label1_Click TimerBtn_Clicke Count Total TextLine@ TimerBtn Caption] Diff@ ScrollValueBox_Change MaxLbl_Click~ TextBox_Change@ TextBox_LostFocus QuitBtn Enabled False MIN_VALUE MAX_VALUE MinLble MaxLbl SmallChange LargeChange properties PrintBtn_Click FilenameI CurrentLineNumber$ MAX_LINES/ PrintHeadingq Printer; BadFileG ExitSub PrintHadingW PageNumber PageNum} PageNumStr PrintTab TAB_SIZE5 PageNumberStr Pageq TextBox_KeyPress KeyAScii Check4_Clicky HiddenChk_Click" PatternBox_Change5 WindowStaten PatternBoxw DiskDrv_Change TreeDir DiskDrv Drive FileFlb_Click FileFlb ArchiveChk_Click Archive ArchiveChk SystemChk_Click System^ SystemChk ReadOnlyChk_Click ReadOnly ReadOnlyChk NormalChk_Click Normal( NormalChkh Hidden HiddenChkK TreeDir_Change PatternBox_KeyDown KeyCodeD Shift PatternBox_KeyPressJ PatternBox_LostFocus Pattern FindFileBtn_Click5 Text1_Change~ FindFileBox ListCountx NotFound FindFileBox_Change FindFileBox_KeyPress ListIndexd Label2_ClickX BinSearchE Medianm Media9 FileListBox FileFlb_PatternChange DirectoryLbl_Click DriveLbl_Click FileAttrFrm_DragDrop Source FilesLbl_Click FindFileLbl_Click PatternLbl_Clicki SUB_KEYWORD FUNCTION_KEYWORD END_SUB END_FUNCTION SortVBfileBtn_Click GetFilenamef GetFileExt Filename_ MainFilename0 ExtFilenameK InputFileNumQ FreeF" ProcName Procy GetExtFile IsSub/ LineNum CountProc Rename FileNum FullFilename TheFilename MaxProc# CountPorc GetProcName GetSubName GetFunctionName OutputFileNum GetTempFilename GetTempFile SortProcedureData OutputFile CountPoc8 Skipp SkipY InOrderd IntegerDim inetger TempProcName TempFileNum MousePointer Form1 ViewFileBtn_Click PrintFileCom_Click Switch DiskDrv_Change update file tree path when the disk is changedg Form_Load *.txt" *.txt" set Archive and Normal attributes to True and all of the other file attributes to False GetFileExt get the file extension name locate the "." in the filename found the "." ? get the file extension name file extension name is a null stringl GetFilename get the file name (without the dot delimiter) locate the "." in the filenamee found the "." ? extract the filename without the dot delimiter filename has no dot delimitor GetFunctionName get the name of the declared Function locate the open parenthesis Function " extract the name of the functionc GetSubName get the name of the procedure locate the open parenthesis extract the file name GetTempFilename return the name of the temporray file #N (as $.$$$) n return the larger value of I or J PatternBox_KeyPress PatternBox_LostFocus locate and remove multiple wildcardse find first spacef PrintFileCom_Click performs a simple print task d hourglass get the next file bufferd obtain the full filenameb open file read each line and print it close printer buffero close file buffer restore mouse pointer QuitBtn_Click SortProcedureData perform a Comb-sort on the arrays ProcName and FileNum. The arrays are sorted IN DESCENDING order by using the data in ProcName. swap array members SortVBfileBtn_Click main filename extension name declare file I/O channel variables9 declare procedure counters0 declare dynamic arrays for procedure namesI namey file number hourglass obtain the full filenamep extract main filename, including the path extract the file extension name delete previous ".BAK" file turn off error-handler rename file as .BAK first pass simply counts the number of procedures in the filet get the next file bufferd initialize procedure countere clear text box loop to read examine each linen Function " insert procedure heading in the text box close file buffer found no procedures rename file back to originalA No Sub or Function were found" Information"& restore mouse pointer redimension the arraysr start pass 2s get the next file bufferd get the next file bufferd open the temporary file $0.$$$ that stores the generalr declarations sectioni loop to locate the Sub and Function declarationse read the next linei does the line contain a Sub procedure?' get procedure name get the name of the next $n.$$$ filee close current filec get the next file bufferd open file $n.$$$, where n = CountProc Function " get function name get the name of the next $n.$$$ filee close current filer get the next file bufferd open file $n.$$$, where n = CountProc write text line to $n.$$$ filel close file buffersi sort the arrays of procedures set the special value for the element 0 get the next file bufferd open the target filei get the other $n.$$$ filesr get the next file bufferd get the $n.$$$ file namef copy the lines of file $n.$$$ into the target file close input bufferr remove $n.$$$ filen close output buffer restore mouse cursor TextBox_KeyPress TreeDir_Change ViewFileBtn_Click view the target file in TextBox get the next file bufferd