OpenFileDialog dlg;
richTextBox1->Text=dlg.FileNames;

Can someone tell me what am I doing wrong?
I get the following errors
cannot convert parameter 1 from 'cli::array<Type,dimension> ^' to 'System::String ^'

I want to multiselect files and then print their names intoo richTextBox1.
I know that richTextBox1>Text is System::String^ and dlg.FileNames is cli::array.
How can I make a conversion or something to get it working?

Thanks

>Can someone tell me what am I doing wrong?

OpenFileDialog^ dg=gcnew OpenFileDialog(); // Instantiate the OpenDialog
dg->ShowDialog();  
richTextBox1->Text=dg->FileName;  // Assign a file name

>Can someone tell me what am I doing wrong?

OpenFileDialog^ dg=gcnew OpenFileDialog(); // Instantiate the OpenDialog
dg->ShowDialog();  
richTextBox1->Text=dg->FileName;  // Assign a file name

Your code works fine but i don`t need a single filename
(dg->FileName). I need dg->FileNames

>I need dg->FileNames

richTextBox1->Text=String::Concat(dg->FileNames);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.