| | |
How to delete a row in text file?
![]() |
post an example of the textfile, and we can go from there. The concept is fairly simple, however. You open the text file, and while you are reading in all the contents, compare each line with whatever you are looking for (say, the persons social security number), and then if they do not match, add that line to a string (or to another, temp file), and if they DO match, simply don't add it to the new file (or the string variable).
Last edited by Comatose; Sep 11th, 2006 at 10:26 am.
•
•
Join Date: Sep 2006
Posts: 54
Reputation:
Solved Threads: 1
2005/11/11 17:36:13, Event:Access, Door:entry, Card No.:1234, Description:333
2005/11/11 17:36:17, Event:Access, Door:entry, Card No.:1234, Description:333
2005/11/11 17:36:20, Event:Access, Door:entry, Card No.:2222, Description:222
2005/11/11 17:36:26, Event:Access, Door:entry, Card No.:2222, Description:222
hello sir this is the sample of the text file... would you please give me a code which can i delete a specific row... thanks Comatose
2005/11/11 17:36:17, Event:Access, Door:entry, Card No.:1234, Description:333
2005/11/11 17:36:20, Event:Access, Door:entry, Card No.:2222, Description:222
2005/11/11 17:36:26, Event:Access, Door:entry, Card No.:2222, Description:222
hello sir this is the sample of the text file... would you please give me a code which can i delete a specific row... thanks Comatose
•
•
Join Date: Sep 2006
Posts: 54
Reputation:
Solved Threads: 1
thanks for your response.. my project is to create a time and attendance using a reader which the reader createss a textlog
like this
2005/11/11 13:32:45, Event
IN Error, Door:entry, Description:201:44000
2005/11/11 13:39:58, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 13:39:59, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 13:40:03, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 13:40:26, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 13:40:28, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 13:48:58, Event:Card No. Error, Door:entry, Description:66:19157
2005/11/11 13:48:58, Event
IN Error, Door:entry, Description:66:19157
2005/11/11 14:24:03, Event
IN Error, Door:entry
2005/11/11 15:19:59, Event:Card No. Error, Door:entry, Description:66:19157
2005/11/11 15:20:03, Event
IN Error, Door:entry, Description:66:19157
2005/11/11 15:20:05, Event
IN Error, Door:entry, Description:66:19157
2005/11/11 15:20:50, Event
oor Group Error, Door:entry, Card No.:2229, Description:66:19157
2005/11/11 17:36:05, Event
oor Group Error, Door:entry, Card No.:2229, Description:66:19157
2005/11/11 17:36:13, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:36:17, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:36:20, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:36:26, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:36:41, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:36:45, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:36:51, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:37:19, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:37:36, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:37:45, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:37:54, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:38:11, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:38:20, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:39:40, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:41:04, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:43:51, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:50:58, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:51:11, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:51:44, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:52:31, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:52:47, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:52:55, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:53:31, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 18:32:48, Event
assword Error, Door:entry, Card No.:1240
2005/11/11 18:35:32, Event:Access, Door:entry, Card No.:2271, Description:266:55250
2005/11/11 18:35:38, Event:Access, Door:entry, Card No.:2271, Description:266:55250
2005/11/11 18:36:01, Event:Access, Door:entry, Card No.:2271, Description:266:55250
2005/11/11 18:55:41, Event:Access, Door:entry, Card No.:2271, Description:266:55250
2005/11/11 18:57:41, Event:Access, Door:entry, Card No.:2271, Description:266:55250
2005/11/11 19:06:25, Event:Access, Door:entry, Card No.:2345, Description:266:55732
when i open this file in list box us you notice there is some text row that is diff. from the others. that specific row i want to delete because when i save this file in access if there is some row that are diff to the other is creates a error.. thanks
like this
2005/11/11 13:32:45, Event
IN Error, Door:entry, Description:201:440002005/11/11 13:39:58, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 13:39:59, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 13:40:03, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 13:40:26, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 13:40:28, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 13:48:58, Event:Card No. Error, Door:entry, Description:66:19157
2005/11/11 13:48:58, Event
IN Error, Door:entry, Description:66:191572005/11/11 14:24:03, Event
IN Error, Door:entry2005/11/11 15:19:59, Event:Card No. Error, Door:entry, Description:66:19157
2005/11/11 15:20:03, Event
IN Error, Door:entry, Description:66:191572005/11/11 15:20:05, Event
IN Error, Door:entry, Description:66:191572005/11/11 15:20:50, Event
oor Group Error, Door:entry, Card No.:2229, Description:66:191572005/11/11 17:36:05, Event
oor Group Error, Door:entry, Card No.:2229, Description:66:191572005/11/11 17:36:13, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:36:17, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:36:20, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:36:26, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:36:41, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:36:45, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:36:51, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:37:19, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:37:36, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:37:45, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:37:54, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:38:11, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:38:20, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:39:40, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:41:04, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:43:51, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:50:58, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:51:11, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:51:44, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:52:31, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:52:47, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:52:55, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 17:53:31, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2005/11/11 18:32:48, Event
assword Error, Door:entry, Card No.:12402005/11/11 18:35:32, Event:Access, Door:entry, Card No.:2271, Description:266:55250
2005/11/11 18:35:38, Event:Access, Door:entry, Card No.:2271, Description:266:55250
2005/11/11 18:36:01, Event:Access, Door:entry, Card No.:2271, Description:266:55250
2005/11/11 18:55:41, Event:Access, Door:entry, Card No.:2271, Description:266:55250
2005/11/11 18:57:41, Event:Access, Door:entry, Card No.:2271, Description:266:55250
2005/11/11 19:06:25, Event:Access, Door:entry, Card No.:2345, Description:266:55732
when i open this file in list box us you notice there is some text row that is diff. from the others. that specific row i want to delete because when i save this file in access if there is some row that are diff to the other is creates a error.. thanks
Please sir, first answer these questions:
1) do you know how to open a file?
2) Do you know how to read the file one line at a time?
3) Do you know how to check if a line (string) contains specific substring?
And finally
4) Are you trying to learn how to program, or have the program written for you?
1) do you know how to open a file?
2) Do you know how to read the file one line at a time?
3) Do you know how to check if a line (string) contains specific substring?
And finally
4) Are you trying to learn how to program, or have the program written for you?
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
![]() |
Similar Threads
- delete a list in text file (Python)
- read from database and writing the contents into a text file (C)
- to delete contents of a text file (Java)
- to delete contents of a text file (Java)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: create os with visual basic
- Next Thread: please help! vb6 & excel
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






