I wrote code that allows me to store variables in a .ini file with a custom file name. The file name depends on the text in EditBox1. No problems. My problem is how to load these variables from this user-defined file name by selecting a file from the download file window (Windows Explorer).
DataIni:=TIniFile.Create(getcurrentdir+'\save folder\' + EditBox1.Text +'.ini');
Saving Variable Example
DataIni.WriteString('INFO','FirstName',EditFirstName.Text);
DataIni.WriteString('INFO','MiddleName',EditMiddleName.Text);
DataIni.WriteString('INFO','FamilyName',EditFamilyName.Text);
Variable load example
EditFirstName.Text := DataIni.ReadString('INFO','FirstName',EditFirstName.Text);
EditMiddleName.Text := DataIni.ReadString('INFO','MiddleName',EditMiddleName.Text);
EditFamilyName.Text := DataIni.ReadString('INFO','FamilyName',EditFamilyName.Text);
So, for example EditBox1.Text = 'MyFile1', how to load the variables stored in MyFile1.ini by selecting MyFile1.ini from the list of other files?
source
share