Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Use Ini With ListBox1

Posted on 1998-12-01
1
Medium Priority
?
251 Views
Last Modified: 2010-04-04
Hello!!!
I have a ini file and like to put all sections into listbox1
and under each section i like to add to listbox2
example of my ini
[SOFTSEEK]
URL=http://www.softseek.com
[DOWNLOAD.COM]
URL=http://www.download.com

E.g
I like to add [SOFTSEEK] into listbox1 and it's url to listbox2
URL=? into listbox2
Can i do this on event "OnCreate" of the form
Do you have a code..Thanks.....
0
Comment
Question by:mummi
[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
1 Comment
 
LVL 3

Accepted Solution

by:
williams2 earned 100 total points
ID: 1348753
I think I've got it, try this

The INI file should look like this:
[URL0]
name=SOFTSEEK
URL=http://www.softseek.com
[URL1]
name=DOWNLOAD.COM
URL=http://www.download.com


The save it as 'urls.ini' in your project folder. Then the rest is cut'n'paste:

procedure TForm1.FormCreate(Sender: TObject);
var
  IniFile: TIniFile;
  i: Integer;
  Section,FName,FURL: String;
begin
  IniFile:= TIniFile.Create(ExtractFilePath(ParamStr(0))+'Urls.ini');
  i:= 0;
  Repeat
    Section:= 'URL'+IntToStr(i);
    FURL:= IniFile.ReadString(section,'URL','');
    FName:= IniFile.ReadString(section,'Name','');
    If FName<>'' then
    Begin
      ListBox1.Items.Add(FName);
      ListBox2.Items.Add(FURL);
    End;
    Inc(i);
  Until FName='';

end;

0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

705 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