TIP: Click on subject to list as thread! ANSI
echo: delphi
to: DANIL LAVRENTIUCK
from: GARY WEINFURTHER
date: 1997-06-23 08:34:00
subject: TStrings, TIniFile

Danil Lavrentiuck mentioned this to Gary Weinfurther:
 >>>> S1.LoadFromFile(F);    <- Here i have ErroR "EAccessViolation"
 DL> But why the error message is so obscure? Why TString don't handle this
 DL> illegal operation?
Because LoadFromFile is abstract in TStrings.  It doesn't exist.
 GW>> IniFile := TIniFile.Create('some.ini');
 GW>> try
 GW>> Value := IniFile.ReadString('Section', 'Key', 'DefaultValue');
 GW>> finally
 GW>> IniFile.Free;
 GW>> end;
 DL> It's not a solution. He needs to get a list of all keys in section. Work
 DL> with single key - is a wrong way.
There are many ways to accomplish this, including TIniFile.ReadSection.  If 
you browse the help files, you can discover a lot of interesting things.  One 
thing I've found about Delphi:  There's always an easy way to accomplish 
something. Granted, finding out what that easy way is, is not always easy.  

                                ...Gary
--- GoldED 2.41
---------------
* Origin: The Flying Circus BBS, Farmington Hills, MI. (1:2410/905)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.