New topic: 1xn Listbox Data into Another 4xn Listbox
<http://forums.realsoftware.com/viewtopic.php?t=29228> Page 1 of 1 [ 4 posts ] Previous topic | Next topic Author Message rbasic20091005153 Post subject: 1xn Listbox Data into Another 4xn ListboxPosted: Sat Jul 25, 2009 8:35 pm Joined: Sat Apr 04, 2009 5:10 pm Posts: 160 Hola. Umm... I can't figure this out because I'm inexperienced in Basic and also too old. But I'm sure it's pretty basic to a lot of people here. I have several Listboxes in Window1. I want to store data from two Editfields and one Listbox with 'Save As...' Saved variables are stored in a text file, which I've decided to read into another Listbox (SaveListbox) for 'Open...' The first two rows of data read into SaveListbox are a file name and a path to directory where to save a file. I tried to make the transfer of data from SaveListbox to FolderList easier with 'For... Next.' But I failed. Code:FolderList.DeleteAllRows FolderList.Addrow SaveListbox.Cell(3,0) // 4th row FolderList.Cell(0,1)=Trim(SaveListbox.Cell(4,0)) // 5th row FolderList.Cell(0,2)=Trim(SaveListbox.Cell(5,0)) // 6th row FolderList.Cell(0,3)=Trim(DecodeBase64(SaveListbox.Cell(6,0))) // 7th row FolderList.Addrow SaveListbox.Cell(7,0) // 8th row FolderList.Cell(1,1)=Trim(SaveListbox.Cell(8,0)) // 9th row FolderList.Cell(1,2)=Trim(SaveListbox.Cell(9,0)) // 10th row FolderList.Cell(1,3)=Trim(DecodeBase64(SaveListbox.Cell(10,0))) // 11th row FolderList.Addrow SaveListbox.Cell(11,0) // 12th row FolderList.Cell(2,1)=Trim(SaveListbox.Cell(12,0)) // 13th row FolderList.Cell(2,2)=Trim(SaveListbox.Cell(13,0)) // 14th row FolderList.Cell(2,3)=Trim(DecodeBase64(SaveListbox.Cell(14,0))) // 15th row .. I suppose you can see a simple pattern, but I cannot transfer data from 1xn Listbox to 4xn with ease. Hopefully, somebody can figure it out in a minute of their valuable time. I'm disappointed with my helplessness. Thank you for your advice. Tom _________________ Mac OS X 10.5.6/REALBasic 2008 R4 I say 'no' to MBS plug-ins. I boycott them. Top DaveS Post subject: Re: 1xn Listbox Data into Another 4xn ListboxPosted: Sat Jul 25, 2009 9:00 pm Joined: Sun Aug 05, 2007 10:46 am Posts: 1330 Location: San Diego, CA Code: dim i as integer dim j as integer dim last as integer folderlistbox.deleteallrows for i=3 to savelistbox.listcount-4 step 4 folderlistbox.addrow savelistbox(i,0) last=folderlistbox.lastindex for j=1 to 3 folderlistbox.cell(last,j)=savelistbox.cell(i+j,0) next j next i That should work _________________ Dave Sisemore MacPro, RB2008r3.1 Top rbasic20091005153 Post subject: Re: 1xn Listbox Data into Another 4xn ListboxPosted: Sat Jul 25, 2009 9:34 pm Joined: Sat Apr 04, 2009 5:10 pm Posts: 160 Hello, DaveS. Thanks a lot for your prompt reply. Whoa... It's so simple, but I don't think I could have figured it out myself. After changing Code:folderlistbox.addrow savelistbox(i,0) to Code:folderlistbox.addrow savelistbox(i,0) , the code runs fine. I'm sorry to be demanding. But every 4th line after deleteallrows requires special attention because a relative path needs to be translated back with DecodeBase64. So it's different from other three lines. Yours truly, Tom _________________ Mac OS X 10.5.6/REALBasic 2008 R4 I say 'no' to MBS plug-ins. I boycott them. Top rbasic20091005153 Post subject: Re: 1xn Listbox Data into Another 4xn ListboxPosted: Sat Jul 25, 2009 9:59 pm Joined: Sat Apr 04, 2009 5:10 pm Posts: 160 Hola, I edited DaveS's code, and my desperation effort seems to work. Code:Dim i,j,k As Integer Dim last As integer FolderList.DeleteAllrows For i=3 To SaveListbox.ListCount-4 Step 4 FolderList.Addrow SaveListbox.Cell(i,0) last=FolderList.LastIndex For j=1 To 2 FolderList.Cell(last,j)=SaveListbox.Cell(i+j,0) Next j For k=3 To 3 FolderList.Cell(last,k)=DecodeBase64(SaveListbox.Cell(i+k,0)) Next k Next i There was no way of myself figuring it out without DaveS's kind and prompt response. Tom _________________ Mac OS X 10.5.6/REALBasic 2008 R4 I say 'no' to MBS plug-ins. I boycott them. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 4 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
