I am using GetFiles(string,string) to find .txt files in folders.
The code that I am using look like this:

folderBrowserDialog1->ShowDialog();
System::String ^ files3 = folderBrowserDialog1->SelectedPath; 

this->textBox1->Text = Directory.GetFiles(files3,"*.txt");

The compiler says that "Directory" is a undeclard identifier and left of .GetFiles must have class/struct/union.

I am not sure if I can figure out what is missing, I have a feeling that I need a string array in any way ?

Thanks for reply. I have changed the code to this and also attached:
using namespace System::IO;
Now my compiler says:
cannot convert parameter 1 from 'cli::array<Type,dimension> ^' to 'system::string ^

folderBrowserDialog1->ShowDialog();
System::String ^ files3 = folderBrowserDialog1->SelectedPath; 

this->textBox1->Text = Directory::GetFiles(files3,"*.txt");

What could be missing ? As files3 is the path and is declared as System::string ^ and
Directory takes System::string ^ I get a bit confused.

See the examples here

I thik you want this: (see the :: scope operator) this->textBox1->Text = Directory::GetFiles(files3,"*.txt");

I have looked this up and can understand that it should be put like this and also put using System::IO in my source file.
Though, now I get a compiler error that look like this wich from I can understand Directory has a format of a cli::array<Type,dimension>
So I beleive I need to convert that to System::string ^ but cant really not figure out how ?

compiler error from code below:
cannot convert parameter 1 from 'cli::array<Type,dimension> ^' to 'System::string ^
with
[
Type=System::string ^,
dimension=1
]

folderBrowserDialog1->ShowDialog();
System::String ^ files3 = folderBrowserDialog1->SelectedPath; 

this->textBox1->Text = System::IO::Directory::GetFiles(files3,"*.txt");

Learn to read MSDN and navigate the links it contains. You will find examples of all your questions here

This article has been dead for over six months. Start a new discussion instead.