I’m trying to initialize a combo box with the content of an INI file. Each line of the file contains a name for a website and the path to that site, tab delimited.
I’m trying to read the file into a list so I can sort it etc.

Visual studio won’t let me use a struct in a managed class:

private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
				using namespace std;
				struct website {
					std::string name;
					std::string path;
				} newsite;
				std::list<website> websites;
				string line;
				ifstream myfile ("HowToInit.ini");
				if (myfile.is_open())
					while ( myfile.good() )
						getline (myfile,line);
						size_t tabpoint = line.find_first_of('\t');
						newsite.name  = line.substr(0,tabpoint).c_str();
						newsite.path = line.substr(tabpoint).c_str();
					// create dummy file here
				this->comboBox1->SelectedIndex = 2;

I also tried using a std::pair<string,string>, but it won’t accept the first and second notation either.
What is the correct coding for something like this?

using namespace System::Collections::Generic, you can use a List<String^>^
It has a Sort method built in.

I found the answer to my own question -- almost by accident!

My first thought was to see how HTML does it, "onLoad". While looking for that I decided to double click the form itself and it created the Form1_Load procedure where I was able to insert my initialization code.

private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
                   this->comboBox1->SelectedIndex = 2;

You just have to love the documentation for Visual Studio. Even knowing what I did, I can't find the documentation anywhere that says to double click the form to initialize it!

This question has already been answered. Start a new discussion instead.