Deleting A File And Send Them To The Resicle Bin Instead?
Aug 29, 2011
I am using this code below to delete files. Doing this permanintly deletes them, is it poseble to send them to the Resicle Bin instead?
System.IO.File.Move(OriginalImagePath, NewImagePath)
Hendri Bissolati noviceprogrammer@vodamail.co.za
View 5 Replies
ADVERTISEMENT
Aug 2, 2010
I am creating a program that allows a person to enter details about their farm, stock, and machinery in order to electronically keep track of all of the information. I have created the forms and done all the coding for the data entry, and now what I would like to do is allow the user to delete a single record from the .dat file. I am able to delete it from the LstBox (using a "Delete Entry" btn coded simply with
lstvehicles.Items.RemoveAt(lstvehicles.SelectedIndex)
(using the vehicles section for examples)), but I am unsure of how to delete it from the .dat file as well, to prevent it reloading upon data change / program reload. Also I would like to be able to have a reminder come up on the program start up that gives a reminder to (in the vehicles instance)when a vehicles rego is due, the date being associated to a date that is entered into the same lstbox data using a datetimepicker.
View 5 Replies
Mar 16, 2009
i just want to ask how can i save the file location or directory of a file in mysql without deleting its slashes...i tried to save it directly.. for example: the original directory is c:folderimg.jpg and when i checked it on mysql it is save as c:folderimg.jpg
View 5 Replies
Mar 22, 2009
I know that Deleting a specific line in a sequential text file is impossible but instead copy the needed lines and not copying the unneeded ones to an output file .. killing the old one and renaming the new one with the same.. I can't make this step...
That is my record file
Code:
Input #1, CustomerName, CustomerHomeAddress, CustomerBussAddress, CustomerTel1, CustomerMob1, CustomerID, DateRent, CarRegPin
Code:
"Josek Sam","68 West Land Street","149 Union of States","4524563","45635463","JOSKSAM1",#2009-03-02#,"MILANCGLZ2008"
"Josef Malm","142 Unions Street","64 Hamersters Street","452504","42542054","JOSFMALM2",#2009-03-06#,"MILANCGLZ2008"
"Dave Green","131 Oxford Street","96 BlueBane Route","452542452","43254345","DAVGRN3",#2009-03-07#,"MILANCGLZ2008"
I made a form that when you put your CustomerID in Text3 Box.. it access the records and make some calculations. now.. The customer will return the car.. Then his data should be deleted.. I want to know how to make that when I enter the CustomerID and press on the Command button .. It copies the other lines to a new output folder and doesn't copy these ... So it appears to be deleted using this way..
View 3 Replies
Jun 17, 2011
I need to delete some rows from csv file based on a column value. Here is my sample.csv file [code]In my vb.net winforom application, I have to read this file and need to delete the rows related to 06/06/10 date column values then write the remaining rows into new.csv file. So far my program works on reading whole data present in the file.[code]
View 2 Replies
Apr 20, 2012
i am creating a console app that will delete pictures from a directory every 30 minutes. Problem is that its being populated by files every minute or so. So if i go and delete files in that directory then it may cause an error trying to delete a file thats being created just then or opened.
I currently have this code to copy the files to another directory and then delete them from the source directory.Dim f() As String = Directory.GetFiles(sourceDir)
[Code]...
View 2 Replies
May 10, 2011
at System.IO.__Error.WinIOError(Int32errorCode, String maybeFullPath) at
System.IO.File.Delete(String path)
at
[code]....
View 2 Replies
Dec 31, 2009
i've tried to make it so Button5 Deletes what TextBox1 says I know its
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If File.Exists("FILE.TXT") Then
File.Delete("FILE.TXT")
[code]....
But I want it to find and delete what TextBox1 Says.
View 6 Replies
Apr 7, 2010
I have an aspx page in VB that fills a pdf with data from a web form.I'm using iTextSharp for this and I have no problem with this.This is the second time I've created anything for pdf's and I'm using the code from the first script.The first script wrote the filled in pdf to a directory on the server where one person could access those via another aspx page. I wrote that code probably a year ago.Now, instead of having the filled in pdf sit on the sever, I have to email it, which I was successful at doing.The only issue left is to delete the filled in pdf from the directory.I tried to use file.delete(), but I got an error stating the the file was being used by another process.how to stop the process in order to be able to delete the file.[code]
View 3 Replies
May 26, 2010
I have been searching trying to figure out the syntax for this but it escapes me.I am adding records saving and retrieving no proble but how do I delete a record.So far all I have seen in the Database using msAccess is the record marked #DELETED but is not really deleted. Here is my code.
View 7 Replies
Aug 9, 2010
I'm trying to delete a file in the FormClosed method, but I get an error saying it's in use by another process. At this point in my program it's not needed anymore. Is there any way to take control of it and delete it, or is there a better method to try to delete it in?
View 8 Replies
Apr 18, 2011
I have the following xml file output below where Deleteme="true" is written when the user clicks on the row's checkbox. I was thinking that once the data is flagged this way I could read the data back in, somehow delete each row specified as above, and then save the data back out.
[Code]...
View 2 Replies
Jun 10, 2009
i've made a playlist system. It writes all the music file url's to a file separated by a comma. But I want to have a delete button that removed one of the playlist items.
This is what I've tried:
Dim EntireFile
Dim myReader As New System.IO.StreamReader(playlist, System.Text.Encoding.Default)
EntireFile = myReader.ReadToEnd()
[Code]....
View 2 Replies
Aug 22, 2009
The program first creates a file and use it but then I want that file to be deleted and I'm using the command as follows[code]...
View 1 Replies
Aug 23, 2010
I have written a conversion (vb6) tool that migrates data (SQL 2008) from one database to another and I make some temporary files (.bak files)I would like to delete after the conversion finishes. The application will not be running on the SQL Server so I need to remotely delete the files. Is there a way to delete a file remotely without having to use an administrative share or the xcmd in SQL Server?
View 2 Replies
Dec 30, 2009
I am sucessfully getting pictures and displaying them but having problems deleting them heres everything I am trying to do: frmCapture:Takes pictures from the webcam and stores them in a location with random filenames..User then ends this process by a button which disposes this form and displays the next one below [code]This form then gets all the files in that directory and uses back and forward buttons going through the images in a picture box.When finished the user then hits a close button that displays another form and disposes that one (this new form waits 5 seconds then tries to delete all files in that directory however its getting an access denied because the file is still in use.[code]
View 4 Replies
Oct 18, 2010
Question: I have an ini file which I need to clear before I add info to it.Unfortunately, if I just delete the file, the permissions are gone as well.
View 4 Replies
Jul 15, 2009
I have a function that is called getWinTemp, it is below, the point in this is to create a temp file in the directory and then stuff it full of calculations and then delete it when the code has finished with it, does this code do that in .net??
Public Sub cleanInput(infile As String, width As Integer)
tempfile = getWinTemp
Name infile$ As tempfile
Open tempfile For Input As #1
[code]....
View 4 Replies
Nov 11, 2009
In my app i have to copy and then delete image files from memory cards, the problem comes when some of the card inadvertantly have the "Lock" switch engaged turning them to read only.
When trying to delete these files i want to log the failure to delete but not show any UI messages until a time of my choosing.
Here is some sample code i am having trouble with.
Sub Main()
Try
System.IO.File.Delete("K:BYZTCSQ_0050.JPG")
[Code]...
This works fine when debuging i.e. it tries to delete the file and if not the error is caught and i can proccess it as nessecary, but when i build and run the app i get an error message telling me that the file cannot be deleted.
To test this code you will need a drive that can be physically set to read only (USB memory key, SD card) and try to delete a file on it while debuging and after a build.
Why would the same code run differently and how can i stop the excess error messages?
View 2 Replies
May 19, 2011
I have a VB.Net 2010 app and need to delete a file from the hard drive when the app opens up (cache file). What command will perform this action? I know the name in advance, so I can format the command right in the app.
View 1 Replies
Jan 19, 2010
I have been working on software that finds a specific backup file type and lists it in a list box. Then the user selects the files he/she wants to delete. Then clicks the delete button to remove the files.I have everything finished and working excpet for deleting the actual file. I figured out the code to delete the actual list item... but I cannot figure out how to get the selected file to be deleted within its directory as well... been at it for 4 hours now.
View 4 Replies
Jul 25, 2011
I am doing some txt file programming and i came to the problem...I could write what is in a combobox in a txt file to then read it when the app is opened again.But if i want for example to delete a line in the text file.I want for example if i have in the combobox 1,2,3,4,5 and 6 and i select 5 and i touch a button delete , i want the application to check if the value(5 in this case) is in the etxt file and delete
View 3 Replies
Apr 5, 2012
i have to make a program thats a telephone directory. All the information is in different text files. The user has to be able to delete and add people to the directory, i have made it so they can add peple no problem but im having a hard time with the code for deleting them. The questions requires that they only type in the persons name and then they are delted but in the text file they are listed as Fred,123-1234 so when they hit delete the person does not get deleted becuase it is registering there full name as Fred,123-1234 i need it so that it just sees the word Fred and deletes it heres the code. I cant figure out how to do it itried using a query but that didnt work either it just looped infinitely.
Private Sub btnRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemove.Click
Dim Removename As String = txtName.Text
If Removename <> "" Then
[Code]...
View 2 Replies
Feb 24, 2012
I need to delete some characters in a line from a text file.
How can do this using forms?
for example I have
1.pencil hbewe wqeqwe
2.pencil 2bq
wqweqeqw
3.eraser eqweqw eqweqw
I want to keep only the
1. pencil
2.pencil
3.eraser
in the file. How to do that?
View 7 Replies
Nov 3, 2011
I now have a similar xml problem. Now that I can create and add to the file, I only have two more problems to solve.
1) How do I remove all nodes (without starting over from scratch, hopefully)?
2) How can I limit the number of nodes in the xml file?
That should do it (for now at least) until somebody wants some other feature.[URL]..
View 2 Replies
Dec 4, 2009
I have a file with information about people, and use the following code to show the contents ofthe file in a list box..
[Code]...
View 1 Replies
Jan 12, 2010
Suppose I collect names from a text box and append them to a file ( names.txt) during the day. How can I either delete the file or at least empty it so tomorrow I can start with a blank file again
View 2 Replies
Apr 27, 2009
I want to be able to delete all files in a specific directory, but exclude a specific extension.[code]I can't target a specific file type because there are many file types and during this process, there could be a file type that wasn't there to begin with.
View 6 Replies
Jun 21, 2010
Ok so i have a uni assignment to delete lines of text out of a text file, so far i have figured out how to search the text file for specific bits of text, i,e name of user, ive also used a loop to find out what line in the text file the specific line exists as...my
code so far is
Dim line As String
Dim Input As StreamReader
[code]....
the selected policy is what im tryin to use to write over the line of texts that already exists however i think that maybe instead of deleteting what exists it will just move it down a line and make a blank line
View 3 Replies
Jun 21, 2010
I'm writing a email program and i need to make it so that when I delete a item from a listbox it also deletes from a text file. Right now all it does is delete it from the listbox and when the program is reloaded its still there.
Dim arrEmailSelect As New List(Of Integer)
Dim fileContents As String
Dim thisEmail As New email
[Code]....
View 2 Replies