1. Rewrite the code below to read each line of a text file into an array named strFordModel.
DoWhile objReader.Peek = -1
strFordModel (intCount) = objReader.Readline( )
intCount + = 1
Loop
Imports System.IO
Module Module1
Sub Main()
Dim strFordModel(1000) As String
Dim intCount As Integer = 0
Dim objReader As StreamReader
objReader = New StreamReader("Names.txt")
Do While objReader.Peek <> -1
strFordModel(intCount) = objReader.ReadLine()
intCount += 1
Loop
objReader.Close()
For i As Integer = 0 To intCount - 1
Console.WriteLine(strFordModel(i))
Next
Console.ReadLine()
End Sub
End Module
The file "Names.txt":
Liam
Olivia
Emma
Oliver
Ava
Comments
Leave a comment