display .cfg file content

Hi guys!
I'm new in visual c++ 2008, and I need some help.

How to display .cfg file CONTENT in richtextbox from item selected in listbox1?

1
2
3
4
5
6
7
8
9
  I tried to add this: 

if (listBox1->SelectedIndex>=0){
				 
scripter->LoadFile(listBox1->SelectedItem->ToString());
				 }

to "Void listBox1_SelectedIndexChanged..." but it not functional.


I hope you can help.
I'm looking forward to your positive response :)
sry for bad English.
You need to get the name and location of the config file.
Open that file.
Read the contents of the file into a string.
Then set the text of the richrtextbox to be that string.
Thank you for answering.

I tried anything. Can't make it to work :\ I don't know what I did wrong.
Can you identify the name and location of the *.cfg file?
Problem solved!!!

scripter->Lines =IO::File::ReadAllLines(listBox1->SelectedItem->ToString()); this worked for me.
I'm sorry to comment again, but I have another problem with saving the opened file.

It is possible to save richtextbox file without dialogs? Filename and filepath are the same opened in richtextbox.

std::string path ="";
scripter->SaveFile = IO::File::WriteAllLines();
Registered users can post here. Sign in or register to post.