0

I am using a browserdialog to browse to a folder that I know contains .txt files.
When pressing okay. I want all these .txt files to appear in my textFilesBox1.

I have come up with this code that do put the path directory in the textBox1.
I have searched for examples everywhere but cant figure out how to continue this code.
Would appreciate any starthelp

folderBrowserDialog1->ShowDialog();
       System::String ^ TextFiles= folderBrowserDialog1->SelectedPath; 
		
	System::IO::Directory::GetFiles(TextFiles,"*.txt");
		
	this->textFilesBox1->Text = TextFiles;
2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by Ancient Dragon
0

Using VC++ 2008 Express I created a CLI Windows project, added a multi-line text box control, then coded the below function. Note that this may or may not be the best way to do it, but it works. I selected *.sys files instead of *.txt, but all you have to do is change it however you want to.

private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
        String^ namelist;
        array<String^>^  fileEntries = Directory::GetFiles("d:\\", "*.sys");
        IEnumerator^ files = fileEntries->GetEnumerator();
        while ( files->MoveNext() )
        {
            String^ fileName = safe_cast<String^>(files->Current);
            //ProcessFile( fileName );
            namelist += fileName + "\r\n";
        }
        this->textBox1->Text = namelist;
    }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.