Solved

saving several settings

Posted on 2000-04-10
4
132 Views
Last Modified: 2010-04-04
(sorry if this has been asked before..)
I want to save several usersettings to registry. I've created a form with edtiboxes on a pagecontrol and a function to save a setting to the registry. This works fine, but I want to automate the function so that it scrolls trough the pages and save every editbox text property in the Reg. using the editbox name property. (This seems an easy way to store mult. settings; any suggestion is welcome!)
0
Comment
Question by:Diggie
[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
  • 2
4 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 2702100
You can do something like this

  for i := 0 to ComponentCount - 1 do
    if (Components[i].Parent = Pagecontrol1) and (Components[i] is TEdit) then
      with (Components[i] as TEdit) do
        ToRegistry(Name, Text);


Not sure if this is what you're looking for...
0
 
LVL 13

Accepted Solution

by:
Epsylon earned 100 total points
ID: 2702153
This is a more worked-out solution:

var p, c: Integer;
begin
  for p := 0 to PageControl1.PageCount - 1 do
    for c := 0 to PageControl1.Pages[p].ControlCount - 1 do
      if PageControl1.Pages[p].Controls[c] is TEdit then
        with PageControl1.Pages[p].Controls[c] as TEdit do
          ToRegistry(Name, Text);
end;


Regards,

Epsylon.
0
 
LVL 2

Expert Comment

by:mullet_attack
ID: 2702175
Hi Diggie,

Have a look at this article/component from Delphi Informant magazine.

http://www.delphizine.com/features/1997/10/di199710rv_f/di199710rv_d.asp

it can save virtually any aspect of a form to the registry

Mark
0
 
LVL 3

Author Comment

by:Diggie
ID: 2702253
Damn! (Sorry for my language!)
This was my own solution for the problem (although I didn't work out the complete code...). I just wondered if this is the way professional programmers store their settings, or that I was barking at the wrong tree...
Anyway, thank you for your reply (and for showing me i'm not an idiot)
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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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 …

734 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