[Mono-list] An array of SWF icons

Jonathan S. Chambers Jonathan.Chambers at ansys.com
Mon Mar 6 11:08:59 EST 2006

	You can't specify the array size in the declaration. You need.

private TextBox [] IP;


// constructor
	IP = new TextBox[4];

BTW, the fixed keyword is for pinning memory. 


-----Original Message-----
From: mono-list-bounces at lists.ximian.com
[mailto:mono-list-bounces at lists.ximian.com] On Behalf Of Paul F. Johnson
Sent: Monday, March 06, 2006 10:58 AM
To: mono
Subject: [Mono-list] An array of SWF icons


I'm not sure how to do this, so I'm a' askin'

I'm trying to create an array of TextBox icons. All of the text boxes
have the same properties, so creating them as an array makes sense (it
also means I can error handle easier).

Currently, the code looks like this

private TextBox IP[4];


for (int i = 0; i < 4; ++i)
  this.IP[i] = new TextBox();
  this.IP[i].Size = new Size(60, 10);
  // and so on

this.IP.AddRange(new Control[] {this.IP[0], this.IP[1], this.IP[2], 

However, this fails to compile. I've followed the suggestion of adding
fixed before TextBox, but that then complains 

list4.cs (16, 25): error CS1642: `testwindow.IP': Fixed size buffer
fields may only be members of structs

Is there a simple way around this?


"Logic, my dear Zoe, is merely the ability to be wrong with authority" -
Dr Who

Mono-list maillist  -  Mono-list at lists.ximian.com

More information about the Mono-list mailing list