if i have a text file how do i put the lines into an array?
edit: i wanna chek if its there, if not i wanna make it, if so i wanna load it.
Printable View
if i have a text file how do i put the lines into an array?
edit: i wanna chek if its there, if not i wanna make it, if so i wanna load it.
Go here and download this code : http://www.planet-source-code.com/vb...=121&lngWId=10
I had the same problem then i got the project that that link will give you.
Edit- it is in vb.net '02 version
getting every line of the text file
VB Code:
Imports System.IO Module Module1 Sub Main() Dim s As New StreamReader("..\module1.vb") Dim ss(0) As String Dim i As Integer = 0 While Not s.Peek = -1 ReDim Preserve ss(i) ss(i) = s.ReadLine i += 1 End While Dim sss As String For Each sss In ss Console.WriteLine(sss) Next End Sub End Module
Hi,
you must open the textfile with "Open" mode only. But don't forget to put the open statement in "try ... catch.... end try",
because if the file dosn't exist you will be kicked out of your programm ;)
bye