So I just started using Xojo and my first project I wanted to try for learning the program was something for my dad. He asked me a while back if there was something he could have and use that had his most frequently used websites in one place instead of digging through all of their bookmarks and such, he could just access the sites from his own thing. So i figured a small application would do the job just fine. I haven’t had a problem until I got to reading and writing to a file for the application to save inputted data. I have no idea how to make the combo box pull up a list of websites from a file, or how to write any added files in the application to the same file to save it for the next startup.
(Side note: I’m making the application on windows, but he uses an iMac. is the coding different between the platforms?)
I would suggest saving the data into an SQLite database. http://developer.xojo.com/userguide/sqlite Example Projects > Database > SQLite > SQLiteExample.xojo_binary_project
This would make it very easy to read and write data
I’ve tried this code for what I’m trying to do and it’s set to an event for the combo box. I don’t know if that’s the right way to do it or not, but it’s what I’ve got.
Dim line1, line2 As String
Dim f As FolderItem = SpecialFolder.UserHome.Child("List.txt") // your file location
If f <> Nil Then
If f.Exists Then
Dim t As TextInputStream
Try
t = TextInputStream.Open(f)
t.Encoding = Encodings.UTF8
line1 = t.ReadLine
line2 = t.ReadLine
Catch e As IOException
t.Close
MsgBox("Error accessing file.")
End Try
End If
End If
I want the combo box to load a list of items I can choose from, but getting it to load the list in lines to select has been the challenging part…