Hey all, how could I load an HTML file that i have dragged into my project?
I’ve tried:
Window Open Event
Var MyList() as String
MyList.add("Test HTML")
Var Item as String
for each item in MyList
Listbox1.AddRow(item)
next
And in the Listbox1 Change event:
If Listbox1.Selected(0) = True then
HTMLViewer1.LoadHTML (TestHTML)
end if
// TestHTML is the name of the HTML file that I have placed into the project
The error im getting is:
Window1.Listbox1.Change, line 2
Type "HTMLViewer" has no member named "LoadHTML"
HTMLViewer1.LoadHTML (TestHTML)
Hi Robin, you want to show an html file on an htmlviewer by selecting a row in a listbox, right?
this code goes in the change event of the listbox:
var testHTML As FolderItem
I have done it in my 2021 version 1 of xojo like this:
testHTML = SpecialFolder.Documents.Child(“Xojo\When Recodering\TestHTML.htm”)
that is the full path to the html file and it works.
Hi Robin,
Did you do this : “Xojo/TestHTML.htm”
or did you use this : “Xojo\TestHTML.htm”
You have to use “Xojo\TestHTML.htm”
watch the backslash please.
Roger, I tried it the way you told me too and it’s giving me the same error. Apologies I’m not near the computer for the rest of the day, ill post exactly what I’m doing first thing.
Hi Robin,
It’s oke don’t worry about it.
I have made a video for you, hope that will help you. https://youtu.be/LjyRzF9IbrI
or if you go to youtube enter my name with xojo behind it and you will find me.
I thought the name looked familiar, I found your videos on YouTube some time ago and have watched them
Thanks for making them (I also subscribed to your channel)
Robin in an early message you wrote : ```
Window1.Listbox1.Change, line 3
This item does not exist
testHTML = SpecialFolder.Documents.Child(“Xojo/TestHTML.html”)
Highlighting the "Xojo
the highlighting Xojo part is a folder, that is on my computer not on your computer.
You need to adjust that path to where ever you have that TestHTML file in your computer..
Do something for me, put the TestHTML file in your document folder, not in a file or anything else.
Then type this :
var testHTML as folderitem
testHTML = SpecialFolder.Documents.Child(“TestHTML.html”)
If Listbox1.Selected(0) = True then
HTMLViewer1.LoadPage(TestHTML)
end if
You got that error because you don't have a folder called Xojo in your documents.