I've looked for and tried many different methods of trying to open a text file and show the insides inside a text box, but i can't find one that works.
I'll attach the file i'm trying to do it with, basically when you add a name to the list it also creates a text file and i want that new textfile to load inside the bottom text area when you click the name in the list. You'll understand when you've seen the form.
Great Thanks, just tried the saving with using multiline but after i've saved it and then try and view it in the text box again it doesnt show anything below the first line? However the Text file has the multiple line... Ideas?
Private Sub List1_Click()
Open App.Path & List1.Text & ".txt" For Input As #3
Dim s As String
Input #3, s: Text2.Text = s
Close #3
End Sub
Into
Code:
Private Sub List1_Click()
Open App.Path & List1.Text & ".txt" For Binary Access Read Shared As #3
Dim s As String
s= Space(LOF(3))
Get #3, 1, s: Text2.Text = s
Close #3
End Sub
Then you will read the whole file into Text2.Text
If a thread is solved, please click on Thread Tools / Mark Thread Resolved.
If someone helped you very good, consider rating his post by clicking the icon under his name.
Ah now I read your code more specific I see what went wrong:
First you do: List1.RemoveItem
Then you do: Kill App.Path & List1.Text & ".txt"
But at the second command, list1.text is no more, you removed that item earlier.
If you delete the actual file before removing it from the list the problem should be solved.
Good luck
If a thread is solved, please click on Thread Tools / Mark Thread Resolved.
If someone helped you very good, consider rating his post by clicking the icon under his name.
Oh of course! How thick can i get thats very simple, thanks a bunch for pointing that out.. Would've taken me hours to realise that was my problem. Big Help