EDN Admin
Well-known member
hello i need a little help again...
I have a text file which list several lines of text. basically i want to display each line in its own text box so each can be edited as a stand alone string. Then on a click event re-constitute the original text file with the edited lines, and save&replace the whole thing as a singe text file again.
Atm i cant even get each darn line to display in my edit textboxes let alone rewrite the text file
Im getting the text file file names from an arraylist in form1 by picking a reffering name from ItemsLISTBOX. Then im trying to display the reffered files lines to edit in a second form.
heres what ive been trying...
Variables...
StatEDIT - list im trying to store each line in, only getting nothing entries with debug check when i try to assign to it.
StatFile - temp string to hold the concatenated path and file name of the text file i want to open
ItemsLISTBOX - lists of items that referr back to statistics files for each item (the stat file is what im trying to display and edit)
Count - just a counting integer to track the location within the listsublic Class EditItemFORM
Private Sub EditItemFORM_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim StatsEDIT As List(Of String) = New List(Of String)
Dim Count As Integer = 1
Dim Statfile = DataPATH & StatREF(Form1.ItemsLISTBOX.SelectedIndex) & ".txt"
Dim ReadFILE As System.IO.TextReader = New StreamReader(DataPATH & StatREF(Form1.ItemsLISTBOX.SelectedIndex) & ".txt")
For Each line In Statfile
StatsEDIT(Count) = ReadFILE.ReadLine()
Count = Count + 1
Next
ReadFILE.Close()
NameTEXTBOX.Text = StatsEDIT(1) Display first line in textboxty for help...
View the full article
I have a text file which list several lines of text. basically i want to display each line in its own text box so each can be edited as a stand alone string. Then on a click event re-constitute the original text file with the edited lines, and save&replace the whole thing as a singe text file again.
Atm i cant even get each darn line to display in my edit textboxes let alone rewrite the text file
Im getting the text file file names from an arraylist in form1 by picking a reffering name from ItemsLISTBOX. Then im trying to display the reffered files lines to edit in a second form.
heres what ive been trying...
Variables...
StatEDIT - list im trying to store each line in, only getting nothing entries with debug check when i try to assign to it.
StatFile - temp string to hold the concatenated path and file name of the text file i want to open
ItemsLISTBOX - lists of items that referr back to statistics files for each item (the stat file is what im trying to display and edit)
Count - just a counting integer to track the location within the listsublic Class EditItemFORM
Private Sub EditItemFORM_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim StatsEDIT As List(Of String) = New List(Of String)
Dim Count As Integer = 1
Dim Statfile = DataPATH & StatREF(Form1.ItemsLISTBOX.SelectedIndex) & ".txt"
Dim ReadFILE As System.IO.TextReader = New StreamReader(DataPATH & StatREF(Form1.ItemsLISTBOX.SelectedIndex) & ".txt")
For Each line In Statfile
StatsEDIT(Count) = ReadFILE.ReadLine()
Count = Count + 1
Next
ReadFILE.Close()
NameTEXTBOX.Text = StatsEDIT(1) Display first line in textboxty for help...
View the full article