Trouble accessing an array in main() from namespace{}

This pseudo code does 'not' work in a visual studio environment.

In this scenario, line 22 and 25 are undefined because they cannot access the definition in main() even though it is defined.

#include <iostream>
using namespace std;

namespace N{
public ref classForm1 : publicSystem::Forms::Form

Form1(string laArray[], int length)
//constructor code

System::VoidB() {
LoadMyFile (laArray, 2);

void PrintArray(string laArray[], int length)
string fileName1;
fileName1 = laArray[0];

int main(array<System::String^>^args)
std::string laArray[2];
laArray[0] ="hello";
laArray[1] ="bye";
Application::Run(gcnew Form1(laArray, 2));


Actual error and code:



All I am trying to do is display array data produced in main() inside of a textbox window in my form1.
I cannot seem to connect laArray[] in main() with laArray[] in form1
What is 'really' confusing me is that according to accessing info in a namespace from main() requires 'namespace::function variable'.
But I am going the other way, everything should have access to main() as long as you pass it, which I am?????
You better post this in MSDN forums, as here it is unlikely to get an answer for C++/CLI Microsoft propietary language that you are using.
I tried gross overkill.
line 20, added a global

then added line 5
c:\users\wuzamarine\documents\visual studio 2010\projects\winform1\winform1\Form1.h(5): error C2065: 'laArray' : undeclared identifier
Topic archived. No new replies allowed.