Delphi Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreDelphi Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 1st, 2012, 01:18 PM
turkalpk turkalpk is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 29 turkalpk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 36 m 52 sec
Reputation Power: 0
Replace row in .txt file. how.

Hello fellas.


I have a .txt file including date, student number, students name and students surname like

29.08.2012;4566;john;doe
30.08.2012;6577;michael;smith
31.08.2012;5467;josephine;seymour
31.08.2012;5483;michel;doe
01.09.2012;9032;frank;bell
01.09.2012;3456;zoe;smith
01.09.2012;4657;jason;zone

My aim is, according to given specific date, I want to

1) delete relevant row(s)
2) update new row(s).
It is ok, I can find the relevant rows with function:






Problem is, how can I delete then add new row?

For example, if my computer's date is 01.09.2012, my program will find rows

01.09.2012;9032;frank;bell
01.09.2012;3456;zoe;smith
01.09.2012;4657;jason;zone


then change them with new ones

01.09.2012;3345;marianna;guardo
01.09.2012;4753;cindy;gomes



then the whole .txt will be like

29.08.2012;4566;john;doe
30.08.2012;6577;michael;smith
31.08.2012;5467;josephine;seymour
31.08.2012;5483;michel;doe
01.09.2012;3345;marianna;guardo
01.09.2012;4753;cindy;gomes



NOTE: The date will always be the current computer's date. Thus, if exist, the rows going to be affected will always be the last rows, not older rows.

NOTE: The number of rows going to be deleted and the number of rows going to be added are independent from each other.....

Reply With Quote
  #2  
Old September 1st, 2012, 11:18 PM
clivew clivew is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2006
Location: Carlsbad, CA
Posts: 2,045 clivew User rank is Major (30000 - 40000 Reputation Level)clivew User rank is Major (30000 - 40000 Reputation Level)clivew User rank is Major (30000 - 40000 Reputation Level)clivew User rank is Major (30000 - 40000 Reputation Level)clivew User rank is Major (30000 - 40000 Reputation Level)clivew User rank is Major (30000 - 40000 Reputation Level)clivew User rank is Major (30000 - 40000 Reputation Level)clivew User rank is Major (30000 - 40000 Reputation Level)clivew User rank is Major (30000 - 40000 Reputation Level)clivew User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 2 h 37 m
Reputation Power: 382
I am going from memory but isn't it?:
Code:
   listbox.items.delete(i);


You will also get better answers if you actually include the error messages you receive
rather than just add in a comment //THIS DOES NOT WORK
Clive

Last edited by clivew : September 1st, 2012 at 11:21 PM. Reason: Added suggestion about error messages

Reply With Quote
  #3  
Old September 2nd, 2012, 04:25 PM
turkalpk turkalpk is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 29 turkalpk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 36 m 52 sec
Reputation Power: 0
Thank you.

Works perfectly.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreDelphi Programming > Replace row in .txt file. how.

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap