Solved

TIniFile

Posted on 1997-11-18
7
719 Views
Last Modified: 2008-03-17
Hi,

I'm trying to use to ReadSectionValues Method of an Inifile object using a TStringList just as an example in the Delphi helpfile. But I'm getting a AccessViolation Error. What am I doing wrong?
0
Comment
Question by:lizzzard
7 Comments
 
LVL 4

Expert Comment

by:itamar
ID: 1350841
We need some code...
0
 
LVL 2

Expert Comment

by:rigansen
ID: 1350842
Show us your code!!
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1350843
Have you created your TStringList?  You need to create it before calling ReadSectionValues.

JB
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 5

Accepted Solution

by:
ronit051397 earned 50 total points
ID: 1350844
probably you didn't call the 'create' method for one of the objects. Place a button and a memo and try the following which works:

uses Inifiles;
...
procedure TForm1.Button1Click(Sender: TObject);
var xxx: TStringList;
begin
xxx:=TStringList.Create;
with tinifile.create('system.ini') do
begin
  ReadsectionValues('Boot', xxx);
  Free;
end;
Memo1.Lines:=xxx;
xxx.Free;
end;

0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1350845
Why, isn't that what I said???  You would think a guy would know how to call "MyStrList := TStringList.Create;" once he knew that was the problem...
0
 

Author Comment

by:lizzzard
ID: 1350846
Er...I DID forget to use the .create method. Sorry,that was too smart...
Thanks for your kindness...
0
 

Author Comment

by:lizzzard
ID: 1350847
Er...I DID forget to use the .create method. Sorry,that wasn't too smart...
Thanks for your kindness...
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 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

22 Experts available now in Live!

Get 1:1 Help Now