How to load an .ini file in response to changing the With-IniFiles-Filled-ComboBox?

Posted on 2005-04-09
Last Modified: 2010-04-16
Hi Folks!

I'm running into some probs regarding .ini files. I have a combobox filled with different .ini files and I want to load the one which is shown. Selecting a different .ini file in the combobox should then let my app load the selected .ini file. Now I've tried the loading and that goes well > My app responds the way it should. However implementing the combobox thingie causes the IDE to crash and in response requires me to Ctrl-Alt-Del the H*ll outta there.
This is my code:

// This works to my satisfaction >
vg2appinifile1.IniFileName := 'C:\Woordzoeker\Bestand1.ini';

// This clearly doesn't
vg2appinifile1.IniFileName := 'C:\Woordzoeker' + '\'+ cbIniBestanden.Items.Names[0];
// This should now be equal to 'C:\Woordzoeker\Bestand1.ini given that the first item in the combobox is Bestand1.ini right?
// Delphi's IDE answers wrong each time I tried to get this thing working. Closing the app crashes the IDE > it fails to write to the  // c:\woordzoeker directory and it shows the inifiles.pas unit

// Btw this code is under construction :) but since I already stumbled on loading one ini file from the combobox I felt discouraged to continue and try to have the combobox decide which ini file to load. It would be perfect if you could show me how to do that and comment it as well and my guess would be that when I comprehend what I'm doing wrong in the above code, I will then understand how to have the combobox decide which ini file to load more easily.

If you need more info please let me know!

Regards and respect,


Ps as always > providing the working copy&paste stuff grants you points!

**** In general > a big thank you to all-o-ya who make this resource to what it is: The Best Place to visit for solving Delphi (and loads of other!) problems! ******
Kretschzmar, Madshi, Geobul, BlackTigerX, rlibby, Slick812, Ferroccio68, mnasman, Workshop_Alex, Dragonslayer, esoftbg, EddieShipman, Shane Holmes, Carzkiss > thanks a lot guys and I CERTAINLY have forgotten some people who helped me out as well but those mentioned I can almost certainly recall assisting me! In fact there are so many of knowledgeable people here that they're too many to mention and it's easy to forget someone,  but alas > I hope I made myself clear when it comes to expressing my appreciation > Programming wouldnt be so much fun without all of you :) If your name is not in the list then bear with me you were not deliberately forgotten!

Question by:PeterdeB

    Author Comment

    Btw in the second code fragment > The line that reads vg2appinifile1.load should be added. It is present in both cases just for your information.


    LVL 17

    Accepted Solution

    What You've got in cbIniBestanden?
    I would rather say that You should have
    vg2appinifile1.IniFileName := 'C:\Woordzoeker' + '\'+ cbIniBestanden.Items[0];
    or better
    vg2appinifile1.IniFileName := 'C:\Woordzoeker' + '\'+ cbIniBestanden.Items[cbIniBestanden.ItemIndex];

    Author Comment

    Hi Mokule tnx for responding!

    Oh okay > then I'll try that !



    Author Comment

    Problem solved tnx my friend!


    Peter :)

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
    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…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    729 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

    20 Experts available now in Live!

    Get 1:1 Help Now