Dim file as FolderItem
file = SpecialFolder.Desktop.Child(“myFile data”) // opens the file if it is in the specified location
If file <> Nil and file.exists then
Call self.TextArea1.Open(file) 'puts file contents into TextArea1
End if
It works as expected in XOJO Version 2019 Release 1
The contents of the folderitem, “myFile data”. is displayed in TextArea1
but gets this error in XOJO Version 2021 Release 3 Trial
Window1.PushButton8.Action, line 5
Type “TextArea” has no member named “Open”
Call self.TextArea1.Open(file) 'puts file contents into TextArea1
How can I modify it so that it works in XOJO Version 2021 Release 3?
I’m gonna take a stab at this but I don’t think you can “open” a textarea control and put the file contents in there. So maybe something like this?
Var file As FolderItem
Var textInput As TextInputStream
var strFileContent As String
file = SpecialFolder.Desktop.Child(“myFile data”) // opens the file if it is in the specified location
If file <> Nil and file.exists then
textInput = TextInputStream.Open(file)
strFileContent = textInput.ReadAll
self.TextArea1.Text = strFileContent
End If
I have not tested this code, but that should read the contents of the file and then put the content into the textarea control for you.