Paul,
You can't specify the array size in the declaration. You need.
private TextBox [] IP;
...
// constructor
ContainingClass()
{
IP = new TextBox[4];
}
BTW, the fixed keyword is for pinning memory.
Thanks,
Jonathan
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul F. Johnson
Sent: Monday, March 06, 2006 10:58 AM
To: mono
Subject: [Mono-list] An array of SWF icons
Hi,
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],
this.IP[3]});
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?
TTFN
Paul
--
"Logic, my dear Zoe, is merely the ability to be wrong with authority" -
Dr Who
_______________________________________________
Mono-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list
_______________________________________________
Mono-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list