Calling Array in App_Code section

Discussion in 'ASP .Net' started by sck10, Mar 26, 2007.

  1. sck10

    sck10 Guest

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

    }
     
    sck10, Mar 26, 2007
    #1
    1. Advertising

  2. sck10

    bruce barker Guest

    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)


    sck10 wrote:
    > 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,
    > };
    >
    > }
    >
    >
     
    bruce barker, Mar 26, 2007
    #2
    1. Advertising

  3. sck10

    sck10 Guest

    Thanks Bruce,

    Appreciate the explanation...


    "bruce barker" <> wrote in message
    news:...
    > 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)
    >
    >
    > sck10 wrote:
    >> 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,
    >> };
    >>
    >> }
     
    sck10, Mar 26, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sck10

    Calling class in App_Code

    sck10, Aug 11, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    690
    sck10
    Aug 14, 2006
  2. sck10
    Replies:
    5
    Views:
    1,040
    Walter Wang [MSFT]
    Aug 18, 2006
  3. Replies:
    0
    Views:
    484
  4. Replies:
    13
    Views:
    670
    Tim Rentsch
    Dec 17, 2012
  5. kampy
    Replies:
    9
    Views:
    370
    Steven D'Aprano
    Oct 19, 2012
Loading...

Share This Page