Checkbox[,] checkArray = new Checkbox[2, 3]{{checkbox24,checkboxPref1,null}, {checkbox23,checkboxPref2,null}};
I am getting error . How do I initialize it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
OK, I think I see what’s happening here. You’re trying to initialize an array at a class level using this syntax, and one of the checkboxes is also a class level variable? Am I correct?
You can’t do that. You can only use static variables at that point. You need to move the init code into the constructor. At the class level do this:
Then in your constructor: