New topic: Deleting file based from a listbox data
<http://forums.realsoftware.com/viewtopic.php?t=47667> Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message Rivo Post subject: Deleting file based from a listbox dataPosted: Sun Apr 21, 2013 11:19 pm Joined: Tue Aug 29, 2006 4:04 am Posts: 510 Location: Indonesia Hi, I have a code to delete the file which is based from listbox data, Dim fileName As String Dim file,filex As FolderItem dim f as folderitem dim t as textinputstream dim p as string f=getfolderitem("//data/") t=textinputstream.open(f) p=t.readline t.close For i As Integer = 0 to Listbox7.ListCount - 1 file = getfolderitem(p).child("data").child(Listbox7.Cell(i, 2) +".odr") filex = getfolderitem(p).child("data").child(Listbox7.Cell(i, 2) +".done") If file <> nil and file.Exists Then file.CopyFileTo filex End If If file <> nil and file.Exists Then if Listbox7.cell(i,0)<>tgl.text then file.Delete end if End If next before was running when I put the code If file <> nil and file.Exists Then file.Delete end if End If next I dunno why it wont remove the file anymore since I put this line to monitoring the date. if Listbox7.cell(i,0)<>L_date.text then If file <> nil and file.Exists Then //listbox7 col 0 was the date and col 2 was the filename of the file to delete. if Listbox7.cell(i,0)<>L_date.text then file.Delete end if End If next [/code] any helps.? thanks Regards, Rivo Top Ballyanthony Post subject: Re: Deleting file based from a listbox dataPosted: Wed Apr 24, 2013 7:54 am Joined: Fri Apr 19, 2013 2:08 am Posts: 5 If it was working before and it works again if you change the code back, then my conclusion would be Listbox7.cell(i,0) must equal tgl.text I suggest you change the code to: if Listbox7.cell(i,0)<>tgl.text then file.Delete else MsgBox Listbox7.cell(i,0)+chr(13)+tgl.text end if And see what happens Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 2 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]
