im a newbie here, im taking intro to programming wth VB in college and im having problem with the homework
here's what im supposed to do
36. Read 10 digits contained in a text file into an array and then display three columns in a list box as follows: column 1 should contain the original 10 digits, column 2 should contain these digits in reverse order, and column 3 should contain the average of the corresponding digits' in columns 1 and 2.
i asked someone else for help and they gave me a layout, they offered me their code but im trying to hold off on that
here's what i have so far, can't get past the firs part =/
the text file has 10 numbers(vertically)
Public Class Form1 Dim x() As Integer '///Array for the numbers is order Dim y() As Integer '///array for the reversed numbers Dim z() As Integer '///array for the average Dim sr As IO.StreamReader Sub read(ByRef x() As Integer, ByRef sr As IO.StreamReader) sr = IO.File.OpenText("D:\digits.txt") '///opens file Dim count As Integer = 0 Do Until (count = 10) x(count) = sr.ReadLine'///ERROR:Object reference not set to an instance of an object. count += 1 ListBox1.Items.Add(x(count))'///Display x value Loop End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click read(x, sr) End Sub End Class