teamNode = root.AppendChild(xml.CreateElement("Benefactor"))
TheCell = wMain.LB.Cell(0,-1)
TheCell = ReplaceAll(TheCell, Chr(9), " ") // Replace the Tab with a Space
teamNode.SetAttribute("Name", TheCell)
This time it works, but I do not need to place the whole Row there: I will add each cell contents below the provided code as in:
teamNode = root.AppendChild(xml.CreateElement("Benefactor"))
teamNode.SetAttribute("Name", wMain.LB.Cell(0,0) + " " + wMain.LB.Cell(0,1) + " " + wMain.LB.Cell(0,2))
// Put here the code to store each Cell contents as attribute
// This works.
I worked to get code to export the Listbox contents (in a loop and save the contents to file), but I have this trouble. I wrote these simple lines (above) to try to find a solution to this problem, but I failed.
Try TheCell = wMain.LB.Cell(0,0) + " " + wMain.LB.Cell(0,1) + " " + wMain.LB.Cell(0,2) and examine the string in the debugger. Look at the byte values for any problems. You may have a stray Tab character in your data. (Hex 09)
I am unsure that I understand your answer 'it’s late here).
You are right for the case I used LB.Cell(0, -1): in the debugger I saw a hex 9 (strangely coded for Xojo). That is why I replaceAll.
For the two first lines of code (at the beinning), I used your sentence, but TheCell does only hold Cell(0,0) + one (or two ?) spaces, regardless of that appears in the real Cells. In my example, I have First Name, Family Name with real names, and Spouse Name is empty (it was a guy, not a gal).
I will re-read your answer by tomorrow morning after a cup of coffee, to be sure I am really awake.
Do you have any “hidden” columns (width set to 0)?
How many tab characters (hex 09) are there in TheCell between First Name and Family Name?
Not strange at all. Hex 09 is the standard ASCII value for a Tab character. When you use -1 for the column number, Listbox.Cell returns a tab-delimited string of the values for that row.
I will check your suggestions once back home.
Even now this looks strange: If I can get LB.Cell(0,0) text contents, I have to be able to get LB.Cell(0,1) 'cause the cell is filled with text
Strange in the unusual (for me) sense. I forgot, but maybe x7 (for Hex 7) ? It was the first time I saw a Tab coded in Xojos debugger.
At last, I do not really understand why it does not worked yesterday (was I too tired ? Was it Xojo ? My MacBook Pro ? Whatever ?)
I found the problem in the real code. I use a variable for getting the data from the Cells. I do not reset this variable ! (I use it some lines after as a Column Index