Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to delete the information that has a Grid Object, which has a .TXT file as DATA SOURCE

I can't find a function to achieve this. I was planning to delete the .TXT file and then recreate it, but it doesn't allow me why Grid Object is using it.

Any suggestions

Thank you.


What I have tried:

$FileDelete($GetAppPath() &"Data Historica LCB_USB.txt")
$wait (100) 
$File_Copy=$FileCopy ($GetAppPath() &"Data Historica LCB_USB - Copy.txt", $GetAppPath() &"Data Historica LCB_USB.txt",30)
Select Case $File_Copy
 Case -1 
 MsgBox "Timeout time expired. "
    Case 0
 MsgBox "file not deleted.."
    Case 1
 MsgBox "Success: file deleted."
  End Select
Posted
Updated 2-Nov-19 5:10am
Comments
Mohibur Rashid 29-Oct-19 17:07pm    
what script? what platform?
ZurdoDev 29-Oct-19 17:10pm    
If it's locked then you're right, you can't delete it.
RickZeeland 29-Oct-19 21:02pm    
We have no clue what language this is, please use tags or mention the language used.
DerekT-P 31-Oct-19 17:13pm    
The file is in use as it's the data source for the grid. So before deleting it, change the data source to somewhere else (an empty, dummy file perhaps?); delete and recreate your text file, then reset the grid's data source back. No idea what language / platform this relates to, but the above should be generic enough for you to figure out.

1 solution

I solved by disabling the Grid Object, that is, closing the screen where the Grid Object is executing and executing the function that allows me to delete.

JavaScript
$FileDelete($GetAppPath() &"Data Historica LCB_USB.txt")
$wait (100) 
$File_Copy=$FileCopy ($GetAppPath() &"Data Historica LCB_USB - Copy.txt", $GetAppPath() &"Data Historica LCB_USB.txt",30)
Select Case $File_Copy
 Case -1 
 MsgBox "Timeout time expired. "
    Case 0
 MsgBox "file not deleted.."
    Case 1
 MsgBox "Success: file deleted."
  End Select
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900