473,383 Members | 1,840 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Calling Array in App_Code section

Hello,

How do you reference an array in the App_Code section? I tried using
SystemColors[i], 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[i]);
}

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,
};

}
Mar 26 '07 #1
2 1263
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[i]);

-- bruce (sqlwork.com)
sck10 wrote:
Hello,

How do you reference an array in the App_Code section? I tried using
SystemColors[i], 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[i]);
}

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,
};

}

Mar 26 '07 #2
Thanks Bruce,

Appreciate the explanation...
"bruce barker" <no****@nospam.comwrote in message
news:ec**************@TK2MSFTNGP05.phx.gbl...
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[i]);

-- bruce (sqlwork.com)
sck10 wrote:
>Hello,

How do you reference an array in the App_Code section? I tried using
SystemColors[i], 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[i]);
}

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,
};

}

Mar 26 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Eric Smith | last post by:
Is a structure containing an incomplete array as its last element (per paragraph 2 of section 6.7.2.1 of ISO/IEC 9899:1999 (E)) itself an incomplete type? That appears to be indicated by paragraph...
11
by: Steve Franks | last post by:
I'm using VS.NET 2005 Beta 2. I have a helper C# class I wrote that I placed in my /App_Code directory. Everything runs fine locally. However when I use the "Copy Web" function to upload the site...
1
by: motorhead_maniac | last post by:
anyone, how to reference server controls (without .ascx) that are in the app_code folder. The msdn documentation talks about dropping them in and using Page section of web.config to add and...
2
by: clintonG | last post by:
I'm having problems referencing public properties in a MasterPage from a class located in App_Code. I need to learn more about the page life cycle and when the classes in App_Code are accessible to...
4
by: sck10 | last post by:
Hello, I am trying to get the Month from the following using "switch" in my App_Code file. The error that I am getting is: An object reference is required for the nonstatic field, method, or...
5
by: sck10 | last post by:
Hello, I am converting a class in the App_Code folder from c# to vb and am having problems calling the sub procedure. I have created a Sub called HidePanels in the class "General". When I try...
2
by: pradeep_TP | last post by:
Hello, I am trying to use APP_CODE folder for all my class files under VS 2005. After adding APP_CODE in the solution explorer, I added a new web page by right clicking project and selecting add...
9
by: rn5a | last post by:
Is putting a VB class file in the special directory named App_Code the same as relocating the VB class file from the App_Code directory to another directory & then using the VBC tool, compiling the...
1
by: Memphis Steve | last post by:
Is it possible to combine multiple javascipts into one file and then call that file from a linked URL in the head section of an XHTML file? Here are the two scripts I want to use with the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.