Click here to Skip to main content
15,906,645 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to refresh background application when a process is running? Pin
Mike Dimmick14-Aug-06 16:39
Mike Dimmick14-Aug-06 16:39 
GeneralRe: How to refresh background application when a process is running? Pin
yan8815-Aug-06 7:35
yan8815-Aug-06 7:35 
Questionlist view Pin
TAREQ F ABUZUHRI14-Aug-06 7:26
TAREQ F ABUZUHRI14-Aug-06 7:26 
QuestionEnum within a button click event on a form - why compile error [modified] Pin
LuluSailor14-Aug-06 6:42
LuluSailor14-Aug-06 6:42 
AnswerRe: Enum within a button click event on a form - why compile error Pin
Andrew Rissing14-Aug-06 7:00
Andrew Rissing14-Aug-06 7:00 
GeneralRe: Enum within a button click event on a form - why compile error Pin
LuluSailor14-Aug-06 7:11
LuluSailor14-Aug-06 7:11 
GeneralRe: Enum within a button click event on a form - why compile error Pin
Rob Graham14-Aug-06 7:50
Rob Graham14-Aug-06 7:50 
GeneralRe: Enum within a button click event on a form - why compile error Pin
LuluSailor14-Aug-06 9:16
LuluSailor14-Aug-06 9:16 
Thank-you for trying to help, but I am still confused....
Maybe here are some better examples of my dilema in undertanding where I can define an enum? I know I can make the example work by moving where the enum is defined, but I still do not understand why it needs to be moved. Why can't the enum constant be used just like a symbolic constant as my examples below demonstrate?

This does NOT work..... I would think it would, and still cannot understand why not.


namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
enum temps
{
cold = 0,
fp = 32
}


System.Console.WriteLine("freezing is {0}", (int)temps.fp);
}
}
}


But the following does compile...

namespace ConsoleApplication2
{
class Program
{
enum temps
{
cold = 0,
fp = 32
}

static void Main(string[] args)
{



System.Console.WriteLine("freezing is {0}", (int)temps.fp);
}
}
}

And this works, if ditch the idea of using an enum, and use named constants

namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int cold = 0;
int fp = 32;

System.Console.WriteLine("freezing is {0}", cold);
}
}
}
GeneralRe: Enum within a button click event on a form - why compile error Pin
Dave Kreskowiak14-Aug-06 10:36
mveDave Kreskowiak14-Aug-06 10:36 
GeneralRe: Enum within a button click event on a form - why compile error Pin
LuluSailor14-Aug-06 11:42
LuluSailor14-Aug-06 11:42 
Questionsystem properties Pin
Harikrk14-Aug-06 6:40
Harikrk14-Aug-06 6:40 
AnswerRe: system properties Pin
Rob Graham14-Aug-06 7:59
Rob Graham14-Aug-06 7:59 
Questioncreating OCX Pin
Harikrk14-Aug-06 5:27
Harikrk14-Aug-06 5:27 
AnswerRe: creating OCX Pin
Rob Graham14-Aug-06 5:42
Rob Graham14-Aug-06 5:42 
GeneralRe: creating OCX Pin
Harikrk14-Aug-06 5:55
Harikrk14-Aug-06 5:55 
GeneralRe: creating OCX Pin
Rob Graham14-Aug-06 6:17
Rob Graham14-Aug-06 6:17 
GeneralRe: creating OCX Pin
Harikrk14-Aug-06 6:22
Harikrk14-Aug-06 6:22 
GeneralRe: creating OCX Pin
Rob Graham14-Aug-06 7:32
Rob Graham14-Aug-06 7:32 
GeneralRe: creating OCX Pin
Judah Gabriel Himango14-Aug-06 6:22
sponsorJudah Gabriel Himango14-Aug-06 6:22 
GeneralRe: creating OCX Pin
Harikrk14-Aug-06 6:24
Harikrk14-Aug-06 6:24 
AnswerRe: creating OCX Pin
Judah Gabriel Himango14-Aug-06 5:43
sponsorJudah Gabriel Himango14-Aug-06 5:43 
QuestionHow Can I get Keyboard Layout? Pin
3DoorsDown14-Aug-06 4:54
3DoorsDown14-Aug-06 4:54 
AnswerRe: How Can I get Keyboard Layout? Pin
Judah Gabriel Himango14-Aug-06 5:44
sponsorJudah Gabriel Himango14-Aug-06 5:44 
GeneralRe: How Can I get Keyboard Layout? Pin
3DoorsDown18-Aug-06 9:23
3DoorsDown18-Aug-06 9:23 
Questionhow to draw on control Pin
mortadacode14-Aug-06 4:49
mortadacode14-Aug-06 4:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.