Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Make a listbox item active from a read in text file

Posted on 1997-05-16
2
Medium Priority
?
259 Views
Last Modified: 2011-09-20
Hi

I have successfuly put together most of my first app and I'm very impressed with this language.

The problem is that I need to be able to read a short text file into a form's components, modify the form and write the text file back out.

I can make this work with TEdit boxes, but when I try to readln a line, I can capture the line but am unable to make it show up in a list box as the highlighted item

line 2 of text file = "USR 28.8 External"    I need this to be the active entry in a list box as such


LISTBOX1 STRINGS
Cardinal 28.8 Internal
Cardinal 33.6 External
USR 28.8 External   (>THIS NEEDS TO BE THE ACTIVE LINE)
Zoom ~~````                 (OF THE LIST BOX)


My second part of my problem is with another list box. I can read a file into it and delete an item from it, but how do I rewrite the remaining lines back out to the original file such that the deletede entry is not in the re-writen text file..

Any help would be most appreciated

Thanks In Advance



Chris

0
Comment
Question by:chrisj051697
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
sleach earned 200 total points
ID: 1336368
part 1:

for x := 0 to ListBox1.items.count-1 do
begin
  if ListBox1.items[x] = 'USR 28.8 External' then
     ListBox1.itemindex := x;
end;

part 2:
ListBox1.items.loadFromFile('FileName');
{make changes...}
ListBox1.items.SaveToFile('FileName');

0
 

Author Comment

by:chrisj051697
ID: 1336369
Thanks for the help

With part 1, I was getting a type mismatch error in the "if" staement.  Put this looks like is does the job. I'll have to figure out what I was doing wrong

For part two, I was playing with "Assign File" routines. This looks much cleaner.

Chris
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question