' This code go in Form_Load for testing ' For testing purposes we will read AutoExecute Open "C:\config.sys" For Input As #1 ' Am array which will hold each line of our file Dim Lines() As String ' Should our reading loop yeild to windows?? Dim bolYield As Boolean ' A number representing elements in lines() array Dim intNumber As Long ' This variable will hold our files contents Dim strFile As String ' We will calculate how long the method took Dim lngTime As Long ' Should we let windows do something? ' (Yes for BIG files and yes by default) bolYield = True ' This loop will read lines from our file into a ' string array intNumber = 1 ' Get the seconds since midnight lngTime = Timer Do Until EOF(1) ' Increase size of our array ReDim Preserve Lines(intNumber) As String ' Read one line from our file Line Input #1, Lines(intNumber) ' This variables holds our files contents strFile = strFile & vbNewLine & Lines(intNumber) ' Up number of lines by one intNumber = intNumber + 1 ' Should we yeild If bolYield = True Then DoEvents Loop ' Close our file Close #1 ' See how long it took lngTime = Abs(Timer - lngTime) ' Display details about our file. ' Will display line number and contents ' of AutoExec.bat MsgBox "Took: " & lngTime & " second(s)!" & vbNewLine & "Lines: " & _ UBound(Lines) & vbNewLine & "(BOF)" & _ strFile & vbNewLine & "(EOF)", vbOKOnly, _ "File Data"