aha! No problem at all. The file I was loading my lines from had an empty newline right at the end. I added a CATCH as a temporary workaround. Thanks for your help!
On Sun, Aug 17, 2008 at 11:38 AM, Joshua Higgins <[EMAIL PROTECTED]>wrote: > Thank you very much for the reply. > > I have got as far as the FOR EACH section, and I have done > sItem = Split(sLine, " ") to get another array called sItem with the 3 bits > of information I need to add to the TreeView. The problem I'm having is > identifying each part of the array. If I shell "echo " & sItem[0] or [1] or > [2] I get the right bit of information out on the terminal, but I also get > an Out of Bounds error. > > > On Sun, Aug 17, 2008 at 7:30 AM, Doriano Blengino < > [EMAIL PROTECTED]> wrote: > >> joshiggins ha scritto: >> > Hello. >> > >> > I'm just starting out with gambas and need some help. I have a file >> > formatted as follows: >> > >> > itemkey [SPACE] itemname [SPACE] path/to/icon >> > itemkey1 [SPACE] itemname [SPACE] path/to/icon etc...etc... >> > >> > I need to load this data from a file into a treeview. I figure that I >> need >> > to load the file and for each line split it up into the 3 parts and add >> an >> > item to the treeview, then do the same for the next line, and the next >> etc. >> > I'm completely lost on where to start. The LINE INPUT page on the wiki >> only >> > inputs the first line. Any suggestions? >> > >> >> An example from the online help: >> >> hFile = OPEN "/etc/hosts" FOR INPUT >> >> WHILE NOT Eof(hFile) >> LINE INPUT #hFile, sOneLine >> PRINT sOneLine >> WEND >> >> CLOSE #hFile >> >> You open the file, then input one line at a time. This is the classic way. >> Don't forget to close the file (see later). >> >> Another method is to load the entire file into a string, with: >> >> sString = file.load("/etc/hosts") >> >> then you must split this long string into a string[] using something like: >> >> sLines = Split(sString, "\n") >> >> At this point you have a string[] array you can traverse with "for each": >> >> for each sLine in sLines >> ... >> ... >> next >> >> Every single line, obtained by either the two methods, must be again >> splitted in tokes and loaded in the TreeView. >> >> About execute command then exit, I had no problems in doing this: >> >> shell "cd /usr/local/bin; xterm &" >> >> This launches the terminal emulator "xterm" in background. If you exit >> the application, the xterm stays there. >> It is true that open files, environment, signals and other thing may be >> inherited by the child process, but I think this can be solved by the >> ampersand in the end of the SHELL command. >> >> If you need more help, ask again. >> >> Salutations, >> Doriano Blengino. >> >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's >> challenge >> Build the coolest Linux based applications with Moblin SDK & win great >> prizes >> Grand prize is a trip for two to an Open Source event anywhere in the >> world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> Gambas-user mailing list >> Gambas-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-user >> > > > > -- > joshua higgins > >>>>>>------ > -- joshua higgins >>>>>>------ ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user