I have a fully functional code below to read a textfile from a directory and load this into a textbox.
What I have done is to put this code inside a comboBox control and what I am trying to achieve is when you select an item in the comboBox then this textfile will load.

I might wonder what is needed to make this work. I could put this code inside a buttoncontrol and press the button and this will work but the difference is to make it work when you just select an item and this code will then execute.

/*.......Load in textingWindowTemp.......*/
String^ texting = "C:\\Glob\\temp\\" + Loadtextings->SelectedItem->ToString() + ".txt";
std::string texting2;

MarshalString(texting, texting2);

ifstream Loadtexting(texting2.c_str());

std::vector<string> LoadStrat(1000);
std::string Temping;
int counting = 0;

	while( getline(Loadtexting, Temping, '\n') )
		LoadStrat[counting] = Temping;
		counting = (counting + 1);
		System::String^ text;

	for (int id = 0; id < (counting + 1); id++)
		if ( LoadStrat[id].length() > 0 )
		String^ LoadStrat2 = gcnew String(LoadStrat[id].c_str());
		this->richTextBox->Text = text;
		this->richTextBox->Multiline = true;
		this->richTextBox->WordWrap = false;
		text += System::Environment::NewLine + LoadStrat2;	

IIRC, there's a SelectionChangeCommitted event in the ComboBox class. Subscribe to that event and run your code inside the event handler.

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