Click here to Skip to main content
15,920,625 members
Home / Discussions / C#
   

C#

 
AnswerRe: How can i create one button for two events in C# 2008 vs? Pin
Wayne Gaylard19-May-11 22:34
professionalWayne Gaylard19-May-11 22:34 
GeneralRe: How can i create one button for two events in C# 2008 vs? Pin
FeniksReborn19-May-11 23:43
FeniksReborn19-May-11 23:43 
GeneralRe: How can i create one button for two events in C# 2008 vs? Pin
Wayne Gaylard20-May-11 0:04
professionalWayne Gaylard20-May-11 0:04 
AnswerRe: How can i create one button for two events in C# 2008 vs? Pin
Shameel20-May-11 0:05
professionalShameel20-May-11 0:05 
GeneralRe: How can i create one button for two events in C# 2008 vs? Pin
Subin Mavunkal20-May-11 0:59
Subin Mavunkal20-May-11 0:59 
GeneralRe: How can i create one button for two events in C# 2008 vs? Pin
Tony Richards20-May-11 1:35
Tony Richards20-May-11 1:35 
GeneralRe: How can i create one button for two events in C# 2008 vs? Pin
Shameel20-May-11 1:41
professionalShameel20-May-11 1:41 
GeneralRe: How can i create one button for two events in C# 2008 vs? Pin
BobJanova20-May-11 3:21
BobJanova20-May-11 3:21 
If you're going to use the localisation argument then surely you should set the button text to resource strings Wink | ;)

I like to use Tag for this, unless I am already using it for something else, as it really is a property of the button and should be stored with it.

Of course in most cases the button is controlling the state of some business object and you should check that instead:

private Task someBigJob;

private void button1_click(object sender, EventArgs e) {
    if (someBigJob == null || !someBigJob.Running) {
        button1.Text = "Stop";
        // Start the job
        someBigJob.Start();
    }
    else {
        button1.Text = "Start";
        // Stop the job
        someBigJob.Stop();
    }
}


(for the benefit of the OP, I'm sure you know already!)
AnswerRe: How can i create one button for two events in C# 2008 vs? Pin
PIEBALDconsult20-May-11 2:31
mvePIEBALDconsult20-May-11 2:31 
GeneralRe: How can i create one button for two events in C# 2008 vs? Pin
Wayne Gaylard20-May-11 2:52
professionalWayne Gaylard20-May-11 2:52 
GeneralRe: How can i create one button for two events in C# 2008 vs? Pin
J4amieC20-May-11 3:16
J4amieC20-May-11 3:16 
GeneralRe: How can i create one button for two events in C# 2008 vs? Pin
BobJanova20-May-11 3:24
BobJanova20-May-11 3:24 
GeneralRe: How can i create one button for two events in C# 2008 vs? Pin
Eddy Vluggen20-May-11 4:12
professionalEddy Vluggen20-May-11 4:12 
GeneralRe: How can i create one button for two events in C# 2008 vs? Pin
PIEBALDconsult20-May-11 15:06
mvePIEBALDconsult20-May-11 15:06 
GeneralRe: How can i create one button for two events in C# 2008 vs? Pin
FeniksReborn27-May-11 5:56
FeniksReborn27-May-11 5:56 
GeneralRe: How can i create one button for two events in C# 2008 vs? Pin
PIEBALDconsult27-May-11 13:44
mvePIEBALDconsult27-May-11 13:44 
QuestionGetting values from enum with [Flags] attribute Pin
Łukasz Nowakowski19-May-11 21:49
Łukasz Nowakowski19-May-11 21:49 
AnswerRe: Getting values from enum with [Flags] attribute Pin
markovl19-May-11 22:07
markovl19-May-11 22:07 
GeneralRe: Getting values from enum with [Flags] attribute Pin
Łukasz Nowakowski19-May-11 22:09
Łukasz Nowakowski19-May-11 22:09 
AnswerRe: Getting values from enum with [Flags] attribute Pin
markovl19-May-11 22:28
markovl19-May-11 22:28 
GeneralRe: Getting values from enum with [Flags] attribute Pin
Łukasz Nowakowski19-May-11 22:30
Łukasz Nowakowski19-May-11 22:30 
AnswerRe: Getting values from enum with [Flags] attribute [modified] Pin
Luc Pattyn20-May-11 1:31
sitebuilderLuc Pattyn20-May-11 1:31 
GeneralRe: Getting values from enum with [Flags] attribute Pin
Łukasz Nowakowski20-May-11 1:44
Łukasz Nowakowski20-May-11 1:44 
GeneralRe: Getting values from enum with [Flags] attribute Pin
Luc Pattyn20-May-11 2:02
sitebuilderLuc Pattyn20-May-11 2:02 
GeneralRe: Getting values from enum with [Flags] attribute Pin
markovl20-May-11 1:44
markovl20-May-11 1:44 

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.