) Put a button titled Open Answers File. When this button is clicked; open Answer.txt, and read and store the answers in an array of Strings. Close this file.
Imports System.IO
Public Class Form1
Private answers(100) As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub btnOpenAnswersFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenAnswersFile.Click
Dim line As String
Dim FilePath As String = "Answer.txt"
Using reader As StreamReader = New StreamReader(FilePath)
' Read one line from file
line = reader.ReadLine()
End Using
Dim c As Integer = 0
For Each l In line
answers(c) = l
c += 1
Next
End Sub
End Class
Comments
Leave a comment