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

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!

Who is Participating?
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];
PeterdeBAuthor Commented:
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.


PeterdeBAuthor Commented:
Hi Mokule tnx for responding!

Oh okay > then I'll try that !


PeterdeBAuthor Commented:
Problem solved tnx my friend!


Peter :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.