Solved

Why does this cause an error?

Posted on 2003-12-07
3
199 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

825 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