Solved

Why does this cause an error?

Posted on 2003-12-07
3
197 Views
Last Modified: 2010-04-05
In the on form create, why does this cause and error and how do I make this work, I want it to be on the form create paragraph.

  with TRegistry.Create do
      begin
        rootkey := HKEY_LOCAL_MACHINE;
        if OpenKey('Software\Microsoft', False) then
          begin
            StringKeys := Tstringlist.create;

            Getkeynames(StringKeys);
            For j := 0 to (StringValues.Count - 1) do  ** ERROR OCCURS HERE ON STRINGVALUES
              Begin
                    //Why does it give me the error and whats the best way around it if I want to
                    //run this in the form create paragraph?  
              End;
0
Comment
Question by:jexd99
3 Comments
 
LVL 5

Accepted Solution

by:
arjanh earned 50 total points
ID: 9892992
You are mixing up StringKeys and StringValues:

Getkeynames(StringKeys);
For j := 0 to (StringValues.Count - 1) do


Change it to something like

GetKeynames(StringKeys);
For j := 0 to (StringKeys.Count - 1) do
   val := ReadString( StringKeys[j] );
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9892994
u have to get the StringValues before using them.

       StringValues := Tstringlist.create;
       Getvaluenames (StringValues);            {get all value names}
       
0
 

Author Comment

by:jexd99
ID: 9893238
Thanks, I got a little confused to say the least :)
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
Delphi XE2 application frozen on Windows 10 10 267
delphi exception 7 61
Using idhttp to login to instagram 2 75
When i run adoquery my application freezes 26 150
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…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

932 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