Solved

Why does this cause an error?

Posted on 2003-12-07
3
203 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Suggested Courses
Course of the Month6 days, 19 hours left to enroll

622 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