1 Replies - 5229 Views - Last Post: 13 July 2012 - 08:13 AM

#1 rhuljdhv  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 17-February 11

Error on storing array from "Directory::GetDirectories(workbase);&

Posted 13 July 2012 - 08:09 AM

Hi, I have Microsoft Visual C++ 2010 Express installed on my PC.
I have created one project that is of Window Forms Application.
Some how I get one local path in one text box, so what I wanted to do is using that path I want to
get all folder present at that location should popup in Combo Box and List Box.
First I want to do it for combo box.
I tried in this way:

 //Find the subfolder in folder that is Workbase
 String^ workbase;
 //Workbase_Subfeature is a text box
 workbase = Workbase_Subfeature->Text;
 String* d[] =  Directory::GetDirectories(workbase);
 int numDirs = d->get_Length();
 for(int i=0; i < numDirs; i++)
  {
    //Find all folder in workbase and add to combo box
      comboBox_Prog->Items->Add(d[i]);
  }




but I am getting errors for this as below:
1) error C3699: '*' : cannot use this indirection on type 'System::String' for "String* d[]"
2) error C2728: 'System::String ^' : a native array cannot contain this managed type for "String* d[]"
3) error C2440: 'initializing' : cannot convert from 'cli::array<Type,dimension> ^' to 'System::String ^[]'
with
[
Type=System::String ^,
dimension=1
]

4) error C2227: left of '->get_Length' must point to class/struct/union/generic type
type is 'System::String ^[]' for "int numDirs = d->get_Length();"

Is This A Good Question/Topic? 0
  • +

Replies To: Error on storing array from "Directory::GetDirectories(workbase);&

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6064
  • View blog
  • Posts: 23,519
  • Joined: 23-August 08

Re: Error on storing array from "Directory::GetDirectories(workbase);&

Posted 13 July 2012 - 08:13 AM

Moved to CLI C++
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1