Hi Guys,

I am creating a program which needs to get all the info from my gui and store it in an ini file. Then when the program is started again, i need that info to be loaded back up into the gui from the ini file.

So far all of my info from my gui is saved in my ini file with no problem whena button is pressed. But my problem is now adding the data back into the gui from the ini file. I have tried to use readSection but it doesnt seem to work.

Here is the data to write the info from the gui to the ini file

Code:
  IniFile ^iniFile = gcnew IniFile("C:\\files\\axe.ini");
                         iniFile->writeSection("Options", "Startfile", "D:\\Student\\_Files\\__Script.txt");
                         //FileStream ^fs = gcnew FileStream("D:\\Student\\_Files\\Data.ini", FileMode::Truncate);
                         IniFile ^iniFile1 = gcnew IniFile("D:\\Student\\_Files\\Data.ini");
                         
                         TextBoxesData();



                       //sets up the code to count from the first variable to the last in the listbox
                       for(int i=0;i<listBox1->Items->Count;i++)
                       {
                           IniFile ^iniFile1 = gcnew IniFile("D:\\Student\\_Files\\Data.ini");
                        //int count = listBox1::SendMessage(m_hWP_List,LB_GETCOUNT , 0, 0);
                        
                        iniFile1->writeSection("Last Variables","Total_Number_of_Variables","" +listBox1->Items->Count);
                       
                                                String ^str = listBox1->Items[i]->ToString();
                        
                        
                        iniFile1->writeSection("Last Variables", " listBox1_Items"+i.ToString() ,str);
the above works perfectly well, but now, how do i get this info to go back into the listbox1 in this case once the program is started again.

i have tried the following exapmle which compiles, but it doesnt do anything

Code:
                                                  //FileStream ^fs = gcnew FileStream("D:\\Student\\_Files\\Data.ini", FileMode::Truncate);
                         IniFile ^iniFile1 = gcnew IniFile("D:\\Student\\_Files\\Data.ini");
                         
                         TextBoxesData();



                       //sets up the code to count from the first variable to the last in the listbox
                       
                       
                           IniFile ^iniFile1 = gcnew IniFile("D:\\Student\\_Files\\Data.ini");
                        
                        
                        iniFile1->readSection("Last Variables","Total_Number_of_Variables");
but it doesnt do what i want it to.