Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Nov 18, 2017 1:22 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Deleting file based from a listbox data
PostPosted: Sun Apr 21, 2013 11:19 pm 
Offline

Joined: Tue Aug 29, 2006 4:04 am
Posts: 513
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
 Profile  
Reply with quote  
 Post subject: Re: Deleting file based from a listbox data
PostPosted: Wed Apr 24, 2013 7:54 am 
Offline

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
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group