Private Sub btnAverage_Click(sender As Object, e As EventArgs) Handles btnAverage.Click lblAverage2.Text = (Val(txtBoxWk1.Text) + Val(txtBoxWk2.Text) + Val(txtBoxWk3.Text) + Val(txtBoxWk4.Text)) / 4 Dim Filenum As Integer = FreeFile() FileOpen(Filenum, "C:\Users\Windows 7 User\Desktop\Average.txt", OpenMode.Output) PrintLine(Filenum, lblSum.Text) FileClose(Filenum) MessageBox.Show("Current average has been calculated") Dim STUDENT_FILE As String = "C:\Users\Windows 7 User\Desktop\Average.txt" Dim objReader As New System.IO.StreamReader(STUDENT_FILE) Dim strDataline As String 'Data line Dim strArr(2) As String ' Array for bits of line Dim blfound As Boolean Do While objReader.Peek() <> -1 'read the file till the end. strDataline = (objReader.ReadLine()) ' read line and store into variable strArr = strDataline.Split(",") 'Split line and put into array label3.Text = strDataline blfound = True objReader.Close() Loop End Sub
File.WriteAllText("C:\Users\Windows 7 User\Desktop\Average.txt", "blahdiblahblah") Dim value As String = File.ReadAllText("C:\Users\Windows 7 User\Desktop\Average.txt")
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)