Write a simple program to store computer specification information including mem
ID: 3687253 • Letter: W
Question
Write a simple program to store computer specification information including memory size, hard drive size, CPU speed and brand information. The user will enter the required information on the form. Then your program will store the information to the text file. Your program should also have a next button so that the user can enter information for another computer. The information of another computer will be appended to the same text file. Next, implement a function to read the aforementioned text file and display computer specification information on the form. The user should be able to click a next button on the form to get specification information for next computer. Your program should allow a user to select your text file and open this file using the Open File dialog box.
Explanation / Answer
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim file As System.IO.StreamWriter
file = My.Computer.FileSystem.OpenTextFileWriter("c:users anaydocuments est.txt", True)
Dim mem, hdd, cpu, brand As String
mem = TextBox1.Text
hdd = TextBox2.Text
cpu = TextBox3.Text
brand = TextBox4.Text
file.WriteLine(mem + " " + hdd + " " + cpu + " " + brand)
file.Close()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim fileReader As String
fileReader = My.Computer.FileSystem.ReadAllText("C:users anaydocuments est.txt", System.Text.Encoding.UTF32)
MsgBox(fileReader)
End Sub
End Class
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.