Calling Array in App_Code section

S

sck10

Hello,

How do you reference an array in the App_Code section? I tried using
SystemColors, but got the error:
'System.Drawing.SystemColors' is a 'type' but is used like a 'variable'.

Thanks, sck10


CodeFile
------------------
for(int i = 0; i < dtSearch.Rows.Count; i++)
{
myCurve.Bar.Fill = new Fill(SystemColors);
}



Class in App_Code section
-----------------------------
public class List
{
using System.Drawing;
public static Color[]
SystemColors =
{
Color.Blue,
Color.Red,
Color.Yellow,
Color.Green,
Color.White,
Color.Cyan,
Color.Magenta,
Color.DarkBlue,
Color.DarkCyan,
Color.DarkGray,
Color.DarkKhaki,
Color.DarkMagenta,
};

}
 
B

bruce barker

you are having namespace problems. you code is resolving to the system
type SystemColors, because your pulic is nested in a public class.

try:

myCurve.Bar.Fill = new Fill(List.SystemColors);

-- bruce (sqlwork.com)
 
S

sck10

Thanks Bruce,

Appreciate the explanation...


bruce barker said:
you are having namespace problems. you code is resolving to the system
type SystemColors, because your pulic is nested in a public class.

try:

myCurve.Bar.Fill = new Fill(List.SystemColors);

-- bruce (sqlwork.com)

Hello,

How do you reference an array in the App_Code section? I tried using
SystemColors, but got the error:
'System.Drawing.SystemColors' is a 'type' but is used like a
'variable'.

Thanks, sck10


CodeFile
------------------
for(int i = 0; i < dtSearch.Rows.Count; i++)
{
myCurve.Bar.Fill = new Fill(SystemColors);
}



Class in App_Code section
-----------------------------
public class List
{
using System.Drawing;
public static Color[]
SystemColors =
{
Color.Blue,
Color.Red,
Color.Yellow,
Color.Green,
Color.White,
Color.Cyan,
Color.Magenta,
Color.DarkBlue,
Color.DarkCyan,
Color.DarkGray,
Color.DarkKhaki,
Color.DarkMagenta,
};

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top