Solved

Use Ini With ListBox1

Posted on 1998-12-01
1
240 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
1 Comment
 
LVL 3

Accepted Solution

by:
williams2 earned 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Mobile Keyboard covers the display of the TMemo 3 78
delphi parse string to params 3 100
creating threads in delphi 1 82
How to load 2 images in same column in Delphi 2 33
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now