Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8953981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:12:47+00:00 2026-06-15T14:12:47+00:00

This is how I am trying to implement my PictureBox arrays: PictureBox[] column0 =

  • 0

This is how I am trying to implement my PictureBox arrays:

    PictureBox[] column0 = new PictureBox[6];
    PictureBox[] column1 = new PictureBox[6];
    PictureBox[] column2 = new PictureBox[6];
    PictureBox[] column3 = new PictureBox[6];
    PictureBox[] column4 = new PictureBox[6];
    PictureBox[] column5 = new PictureBox[6];
    PictureBox[] column6 = new PictureBox[6];

    PictureBox[][] columns = 
            new PictureBox[][] 
            { column0, column1, column2, column3, column4, column5, column6 };

When I try to make the array of arrays, I get this error:

A field initializer cannot reference the non-static field method, or property ‘Connect_Four_Server.Server.column0’

and same errors for column1, column2, etc.

How does one declaring an array of arrays correctly in this situation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:12:48+00:00Added an answer on June 15, 2026 at 2:12 pm

    There’s nothing wrong with the above declaration per se, but you can’t use it like that if you are declaring fields in a class. As the error states, a field initializer (in your case columns) can’t reference other non static fields (in your case column0, column1…).

    There are 2 approaches you can take:

    Either don’t declare intermediate fields and do it all in one piece (best unless you actually need direct references to columnX):

    PictureBox[][] columns =
            new PictureBox[][] 
            { 
                new PictureBox[6], 
                new PictureBox[6], 
                new PictureBox[6], 
                new PictureBox[6], 
                new PictureBox[6], 
                new PictureBox[6], 
                new PictureBox[6] 
            };
    

    Or put the initialization of columns into the constructor:

    PictureBox[] column0 = new PictureBox[6];
    PictureBox[] column1 = new PictureBox[6];
    PictureBox[] column2 = new PictureBox[6];
    PictureBox[] column3 = new PictureBox[6];
    PictureBox[] column4 = new PictureBox[6];
    PictureBox[] column5 = new PictureBox[6];
    PictureBox[] column6 = new PictureBox[6];
    
    PictureBox[][] columns;
    
    public Server()
    {
        columns = new PictureBox[][] { column0, column1, column2, column3, column4, column5, column6 };
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to AS3 and I'm getting this error while trying to implement OO
Trying to implement a search similar to here .This searches properties based on city,locality,property
I'm trying to implement this algorithm description from a previous question I had here
I'm trying to implement this example http://jsfiddle.net/gzF6w/1/ (from another question here on stak) on
I am trying to implement this package http://code.google.com/p/python-progressbar/ when downloading a file like below:
I am trying to implement this bit of code: func factorial(x int) (result int)
I'm trying to implement this web api autocomplete in a standard mvc app. http://techbrij.com/987/jquery-ui-autocomplete-asp-net-web-api
I'm trying to implement this pattern in my WinForms application (I don't like it,
I am trying to implement this demo on my local machine. http://bit.ly/4g4o1r I have
I'm trying to implement this scenario using Unity and i can't figure out how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.