I have one program writeing numbers to a txt file. I have a second reading this text file and displaying the numbers.
So if the text file has 5 on one line and 15 on the 2nd the code below displays
5
15
in the list box.
How can i get it to read the 1st line display it in listbox1 and display the 2nd line in listbox2
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim fileContents() As String = System.IO.File.ReadAllLines("C:\encrypt.txt")
For i As Integer = 0 To fileContents.GetUpperBound(0)
fileContents(i) = System.IO.Path.GetFileNameWithoutExtension(fileContents(i))
Next
ListBox1.Items.AddRange(fileContents)
End Sub
End Class

New Topic/Question
Reply




MultiQuote




|