Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6988117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:01:51+00:00 2026-05-27T19:01:51+00:00

I’m currently trying to create a Profile Manager using a TIniFile to store the

  • 0

I’m currently trying to create a “Profile Manager” using a TIniFile to store the data, and displaying the data in various components on a form (editboxes and such).

On the form, i’ve got a Combobox. This serves as a way of displaying the “Profile Name” as set by the user.

The data is being stored in the format of 1 profile per inifile section. Each section contains the configuration data for 1 profile including the Profile Name. The profile name key is the same across each section. This is the sort of layout i’ve currently got in the inifile (as an example);

[0]
PROFILE_NAME=Profile 1A
PROFILE_DATA=Profile Data 1A
PROFILE_PASS=Profile Password 1
PROFILE_USER=Profile Username 1
[1]
PROFILE_NAME=Profile 1B
PROFILE_DATA=Profile Data 1B
PROFILE_PASS=Profile Password 1B
PROFILE_USER=Profile Username 1B

What i want to do is load a list of all values with the key “PROFILE_NAME” into a combobox regardless of what section they’re located in. The section names themselves are references to the itemindex in the combobox when that data was added.

From there, i can handle loading the other data into it’s relevant fields, but i’m having a problem figuring out how to load the “PROFILE_NAME” values into the combobox. Any ideas?

For those familiar with the Voice Communication program “Ventrilo”, it features something similar to what i’m trying to achieve with it’s “Server and User Manager”. It’s inifile layout is very similar, and the only difference i can find is that it has a “USER_COUNT” value referencing how many users have been added. Each user has servers assigned to them, rather than the servers being accessible by every user.

Is it possible for me to achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:01:52+00:00Added an answer on May 27, 2026 at 7:01 pm

    You have to use TIniFile.ReadSections to get a list of all the section names, and then you can loop through them and read the individual PROFILE_NAME from each of those sections. (I prefer TMemIniFile, as TIniFile is based on the WinAPI functions directly and has issues sometimes on network drives when trying to update with new values. TMemIniFile also works cross-platform when you get to XE2.)

    I’m creating the TMemIniFile and TStringList and freeing them, but if you’re using them repeatedly you’ll probably want to create them in your form’s OnCreate and free them in FormClose instead; that way you’ll have a list of the section names to match back to the items in the ComboBox when you want to access the rest of the items in the OnClick event to populate the rest of the form.

    var
      Sections: TStringList;
      Ini: TMemIniFile;
      s: string;
    begin
      Sections := TStringList.Create;
      try
        Ini := TMemIniFile.Create('YourIniFile.ini');
        try
          Ini.ReadSections(Sections);
          for s in Sections do
            ComboBox1.Items.Add(Ini.ReadString(s, `PROFILE_NAME`, `Empty`);
        finally
          Ini.Free;
        end;
      finally
        Sections.Free;
      end;
    end;
    

    To make it easier to tie back to the items in the ComboBox, declare a new integer variable (i in my snippet below), and change the for loop to this (make sure you don’t sort the Sections – let the ComboBox handle the sorting!):

    for i := 0 to Sections.Count - 1 do
    begin
      s := Ini.ReadString(Sections[i], 'PROFILE_NAME', 'Empty');
      ComboBox1.Items.AddObject(s, TObject(i));
    end;
    

    To get the section name again when the user clicks a combobox item:

    procedure TForm1.ComboBox1Click(Sender: TObject);
    var
      i: Integer;
      SectionName: string;
    begin
      // Get the Sections item index we stored above
      i := Integer(ComboBox1.Items.Objects[ComboBox1.ItemIndex]));
    
      // Get the associated Sections section name
      SectionName := Sections[i]; 
    
      // Use the retrieved section name to get the rest of the values
      ProfileNameEdit.Text := Ini.ReadString(SectionName, 'PROFILE_NAME', '');
      ProfileDataEdit.Text := Ini.ReadString(SectionName, 'PROFILE_DATA', ''); // etc
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm trying to create an if statement in PHP that prevents a single post
I am using Paperclip to handle profile photo uploads in my app. They upload
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I am currently running into a problem where an element is coming back from
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.