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 6th, 2004, 09:51 AM
Grievem Grievem is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Scotland
Posts: 16 Grievem User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 22 sec
Reputation Power: 0
Send a message via MSN to Grievem
reading and writting to the same text file !!



Hi

I am trying to write 2 text files from 1 text file to populate a combobox and to then populate a edit box on change of the combo box anyway the problem I have is I cant seem to write to the combobox

here is the code any help would be much apprexciated

procedure TForm1.startup(sender: TObject);
var
SomeTxtFile : TextFile;
anotherfile :TextFile;
yetanotherfile :Textfile;
parseline : string;
begin
deletefile('c:\impex\desc.txt');


AssignFile(SomeTxtFile, 'c:\impex\concess.asc');
AssignFile(anotherFile, 'c:\impex\style.txt');
AssignFile(yetanotherFile, 'c:\impex\desc.txt');
Reset(SomeTxtFile);

while not EOF(SomeTxtFile) do begin
ReadLn(SomeTxtFile, parseline);
if copy(parseline,31,1) = 'Y' then begin
WriteLn(anotherfile,parseline,1,5);
WriteLn(yetanotherfile,parseline,1,30);
end;
end;
CloseFile(SomeTxtFile);
CloseFile(anotherfile);
CloseFile(yetanotherfile);
Combobox1.Text := 'anotherfile';
end;

Reply With Quote
  #2  
Old September 7th, 2004, 04:04 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,385 Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 1 Day 21 h 30 m 25 sec
Reputation Power: 4080
You're doing things the wrong way. To add items to a Combobox's menu, simply do this:
Code:
ComboBox.Items.Add('item to add');


In your case, all you have to do is do a ComboBox.Items.Add(parseline); inside your while loop. There's no need to write an intermediate file at all.
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

Reply With Quote
  #3  
Old September 8th, 2004, 05:57 AM
Grievem Grievem is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Scotland
Posts: 16 Grievem User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 22 sec
Reputation Power: 0
Send a message via MSN to Grievem
Exclamation

Thanks works a treat now need to populate a Tedit with part of the parseline info I choose in the combo box.

Reply With Quote
  #4  
Old September 8th, 2004, 12:59 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,385 Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 1 Day 21 h 30 m 25 sec
Reputation Power: 4080
This is very easy too. Note that all TEdit components have a Text property that sets/gets the value of the text in the box. The ComboBox also has a Text property. All you have to do is wire up the ComboBox's OnChange event, so that it changes the text in the text box, whenever the ComboBox's text changes.
Code:
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
	Edit1.Text := ComboBox1.Text;
end;

Reply With Quote
  #5  
Old September 10th, 2004, 03:52 AM
Grievem Grievem is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Scotland
Posts: 16 Grievem User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 22 sec
Reputation Power: 0
Send a message via MSN to Grievem
Thanks thats great and I could already do that however I only want it to put "part" of the Parse line and not the part I have already put in the combobox

Thanks

Reply With Quote
  #6  
Old September 13th, 2004, 03:51 AM
Grievem Grievem is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Scotland
Posts: 16 Grievem User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 22 sec
Reputation Power: 0
Send a message via MSN to Grievem
Barcode

ok thanks have sorted that out now I have a barcode componant from nan-soft on this program ans am trying to print using it

I have a demo version of it however this is in delphi 7 and uses components which come with 7.

Has anyone used this in delphi 5 and if so how did you print

Thanks

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreDelphi Programming > reading and writting to the same text file !!

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