Click here to Skip to main content
15,892,746 members
Home / Discussions / C#
   

C#

 
QuestionVariable to be Accessed throughout code [modified] Pin
MWRivera12-Feb-11 16:37
MWRivera12-Feb-11 16:37 
AnswerRe: Variable to be Accessed throughout code Pin
OriginalGriff12-Feb-11 21:21
mveOriginalGriff12-Feb-11 21:21 
GeneralRe: Variable to be Accessed throughout code Pin
MWRivera13-Feb-11 4:07
MWRivera13-Feb-11 4:07 
GeneralRe: Variable to be Accessed throughout code Pin
OriginalGriff13-Feb-11 5:42
mveOriginalGriff13-Feb-11 5:42 
GeneralRe: Variable to be Accessed throughout code Pin
MWRivera14-Feb-11 15:31
MWRivera14-Feb-11 15:31 
AnswerRe: Variable to be Accessed throughout code Pin
RichardGrimmer15-Feb-11 3:55
RichardGrimmer15-Feb-11 3:55 
GeneralRe: Variable to be Accessed throughout code Pin
MWRivera15-Feb-11 4:03
MWRivera15-Feb-11 4:03 
QuestionSimple calculator Pin
nstk12-Feb-11 7:28
nstk12-Feb-11 7:28 
Hallo everyone,

I want to make a Simple calculator, as an exercise to get familiar with GUI and C#

I can easily drag 10 buttons, name them btn1, btn2... btn0 and then create the appropriate functions like
private void btn1_Click(object sender, EventArgs e)

and let a member variable have the appropriate value.

But...

isn't there a better way to deal with that? Something like having an array[9], where every field is a button, or sort of it?

I find it ugly and really annoying having 10 functions who do quite the same thing.

Thanks...
AnswerRe: Simple calculator PinPopular
Luc Pattyn12-Feb-11 7:37
sitebuilderLuc Pattyn12-Feb-11 7:37 
GeneralRe: Simple calculator Pin
nstk12-Feb-11 11:07
nstk12-Feb-11 11:07 
AnswerRe: Simple calculator Pin
Manfred Rudolf Bihy12-Feb-11 11:19
professionalManfred Rudolf Bihy12-Feb-11 11:19 
AnswerRe: Simple calculator Pin
Luc Pattyn12-Feb-11 11:21
sitebuilderLuc Pattyn12-Feb-11 11:21 
GeneralRe: Simple calculator Pin
nstk13-Feb-11 23:57
nstk13-Feb-11 23:57 
GeneralRe: Simple calculator [modified] Pin
nstk14-Feb-11 3:52
nstk14-Feb-11 3:52 
AnswerRe: Simple calculator Pin
DaveyM6912-Feb-11 12:22
professionalDaveyM6912-Feb-11 12:22 
AnswerRe: Simple calculator Pin
Luc Pattyn12-Feb-11 18:04
sitebuilderLuc Pattyn12-Feb-11 18:04 
GeneralRe: Simple calculator Pin
DaveyM6913-Feb-11 2:48
professionalDaveyM6913-Feb-11 2:48 
AnswerRe: Simple calculator Pin
Luc Pattyn13-Feb-11 3:01
sitebuilderLuc Pattyn13-Feb-11 3:01 
GeneralRe: Simple calculator [modified] Pin
nstk14-Feb-11 10:21
nstk14-Feb-11 10:21 
AnswerRe: Simple calculator Pin
RichardGrimmer15-Feb-11 3:58
RichardGrimmer15-Feb-11 3:58 
Questionerror in timer function Pin
aeman12-Feb-11 4:40
aeman12-Feb-11 4:40 
AnswerRe: error in timer function Pin
Manfred Rudolf Bihy12-Feb-11 5:10
professionalManfred Rudolf Bihy12-Feb-11 5:10 
GeneralRe: error in timer function Pin
aeman12-Feb-11 6:25
aeman12-Feb-11 6:25 
AnswerRe: error in timer function Pin
OriginalGriff12-Feb-11 5:20
mveOriginalGriff12-Feb-11 5:20 
GeneralRe: error in timer function Pin
aeman12-Feb-11 20:07
aeman12-Feb-11 20:07 

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.