drew

drew

  • NA
  • 12
  • 0

Passing Array Values between forms

Oct 31 2009 11:30 AM
I'm currently learning C# and i'm trying to pass array values between two forms, but I keep getting errors.  Here is the code i'm trying to use:
*******FORM1 (JetBulls)********

string[] name = new string[15];
string[] myArray2;
myArray2 = Seats.passValuesMethod(myNewArray);

*******FORM2 (Seats)********
        public string[] passValuesMethod(string[] myNamesArray)
        {
            string[] myNewArray = new string[15];
            return myNewArray;
        }

***
If i place "myArray2 = Seats.passValuesMethod(myNewArray);" outside of a method, i get invalid token errors

If i place it inside of a method, i get System.Windows.Forms.Form does not contain a definition for 'passValuesMethod' and it says the value i'm try to pass doesn't exist in the current context.

Any ideas what i'm doing wrong?  Thanks.

Answers (6)