This code is working great. I have come up with a solution to convert from std::string to System::string ^
With this code I open a browser, browse to a directory and click OK. When choosing whatever directory and press OK the code displays the textfile in a textBox that does exist under the directory "c:\\MyDirectory\\*.txt" as seen in the code. Great !
Now is one thing and this is that I want to display the Whole Directory inluding the found .txt files that is in that choosen directory that I have browsed to.
In order to do this I beleive I have to use:
folderBrowserDialog1->SelectedPath in any way.
Code:
folderBrowserDialog1->ShowDialog();
WIN32_FIND_DATA FindFileData;
HANDLE hFind = FindFirstFile("c:\\MyDirectory\\*.txt", &FindFileData);
if( hFind != INVALID_HANDLE_VALUE)
{
do
{
std::string files = FindFileData.cFileName;
std::string files2 = files.substr(0);
System::String ^ files3 = gcnew String(files2.c_str());
this->textBox1->Text = files3;
}
while( FindNextFile(hFind, &FindFileData) );
FindClose(hFind);
}
Somehow I beleive I have to convert what is selected to just a std::string but dont know how this could be done.
Would be happy for any idéas to this. I tried this but this ofcourse didn´t work:
Code:
std::string Folder = folderBrowserDialog1->SelectedPath;