Answer to Question #267094 in Visual Basic for Maika Togavuto

Question #267094

) 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. 


1
Expert's answer
2021-11-16T13:51:15-0500
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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS