<-- Previous || Up || Next -->

Sample N File Lines Sample Sub
Utilities Class

Private Sub SampleNFileLinesSample()
    Const strFn = "SampleNFileLinesSample"

    Dim strInFile As String
    strInFile = CombinePathAndFile(GetWindowsDirectory, "WIN.INI")
    strInFile = InputBox("Input file: ({Esc} cancels.)", strFn, strInFile)
    If Len(strInFile) = 0 Then Exit Sub

    Dim strNumLines As String
    strNumLines = InputBox("Sample number of lines: ({Esc} cancels.)", strFn, "10")
    If Len(strNumLines) = 0 Then Exit Sub

    Dim intAddLineNums As Integer
    Select Case MsgBox("Add line numbers?", vbQuestion + vbYesNoCancel + vbDefaultButton1, strFn)
        Case vbYes
            intAddLineNums = True
        Case vbNo
            intAddLineNums = False
        Case vbCancel
            Exit Sub
        Case Else
            Stop
    End Select

    MsgBox TruncateRightWithEllipse(SampleNFileLines(strInFile, strNumLines, intAddLineNums), 1024), vbOKOnly, strFn
End Sub

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.