After some pain and suffering, I created a code that reads a text file and passes its content into a ComboBox as its InitialValue.
Here is the code
Dim t As TextInputStream Dim f As FolderItem Dim dlg As OpenDialog Var s As String Var last As Integer Var stream As BinaryStream dlg = New OpenDialog f = dlg.ShowModal() // open open dialog for selecting a file to load If f <> Nil Then stream = BinaryStream.Open(f, False) Do Window1.TextArea2.AddText(stream.Read(1000, Encodings.UTF8)) Loop Until stream.EndOfFile stream.Close End If s=Window1.TextArea2.Text last = CountFields(Window1.TextArea2.Text, ",") for i As Integer = 1 to last Window1.ComboBox1.AddRow(NthField(s, "," , i)) next Return True
I need just a minor modification. I want the text file that supplies the content to have fields separated not by the comas but by the end of line.
So, I do not want the text to be a one string with coma separated entries but rather a list where each line is a new entry for the ComboBox.
Can somebody help please?