Click here to Skip to main content
15,887,214 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to draw a line outside of onPaint event handler? Pin
Guffa1-Oct-08 2:58
Guffa1-Oct-08 2:58 
QuestionEventargs click event runtime created labels Pin
RobScripta30-Sep-08 9:37
professionalRobScripta30-Sep-08 9:37 
AnswerRe: Eventargs click event runtime created labels Pin
Wendelius30-Sep-08 9:42
mentorWendelius30-Sep-08 9:42 
GeneralRe: Eventargs click event runtime created labels Pin
Mbah Dhaim30-Sep-08 10:15
Mbah Dhaim30-Sep-08 10:15 
GeneralRe: Eventargs click event runtime created labels Pin
RobScripta30-Sep-08 10:38
professionalRobScripta30-Sep-08 10:38 
GeneralRe: Eventargs click event runtime created labels Pin
Dan Neely30-Sep-08 10:52
Dan Neely30-Sep-08 10:52 
GeneralRe: Eventargs click event runtime created labels Pin
Mycroft Holmes30-Sep-08 22:58
professionalMycroft Holmes30-Sep-08 22:58 
GeneralRe: Eventargs click event runtime created labels Pin
DaveyM691-Oct-08 2:05
professionalDaveyM691-Oct-08 2:05 
To sum up what Dan and Mycroft said above:
private void label_Click(object sender, EventArgs e)
{
    if (sender is Label)
    {
        Label clickedLabel = (Label)sender;
        // Propertis etc available by clickedLabel. now.
    }
    else
    {
        throw new ArgumentException(
        "The control that called this function was not a Label");
    }
}

I've thrown an exception, but you may want to show a message box or write to the error log so the program doesn't halt, or better still catch the exception elsewhere and handle it then.

Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)

QuestionHow store formatted text [modified] Pin
sepel30-Sep-08 9:05
sepel30-Sep-08 9:05 
AnswerRe: How store formatted text Pin
User 665830-Sep-08 10:07
User 665830-Sep-08 10:07 
QuestionRecording Voice from microphone Pin
Ha ha ha ha ha ha ha ha30-Sep-08 8:12
Ha ha ha ha ha ha ha ha30-Sep-08 8:12 
AnswerRe: Recording Voice from microphone Pin
Mbah Dhaim30-Sep-08 10:29
Mbah Dhaim30-Sep-08 10:29 
GeneralRe: Recording Voice from microphone Pin
Ha ha ha ha ha ha ha ha30-Sep-08 22:25
Ha ha ha ha ha ha ha ha30-Sep-08 22:25 
GeneralRe: Recording Voice from microphone Pin
fiko851-Oct-08 7:05
fiko851-Oct-08 7:05 
GeneralRe: Recording Voice from microphone Pin
Ha ha ha ha ha ha ha ha2-Oct-08 22:15
Ha ha ha ha ha ha ha ha2-Oct-08 22:15 
QuestionMultiple Threads Pin
Ha ha ha ha ha ha ha ha30-Sep-08 8:10
Ha ha ha ha ha ha ha ha30-Sep-08 8:10 
AnswerRe: Multiple Threads Pin
Ashfield30-Sep-08 21:20
Ashfield30-Sep-08 21:20 
GeneralRe: Multiple Threads Pin
Ha ha ha ha ha ha ha ha30-Sep-08 22:35
Ha ha ha ha ha ha ha ha30-Sep-08 22:35 
QuestionReg:Data Grid Display index and Scrool bar problem Pin
Member 400849230-Sep-08 7:28
Member 400849230-Sep-08 7:28 
AnswerRe: Reg:Data Grid Display index and Scrool bar problem Pin
Mycroft Holmes30-Sep-08 23:06
professionalMycroft Holmes30-Sep-08 23:06 
QuestionGet FileInfo of an Audio [modified] Pin
schiebel-t30-Sep-08 7:09
schiebel-t30-Sep-08 7:09 
AnswerRe: Get FileInfo of an Audio Pin
Giorgi Dalakishvili30-Sep-08 7:55
mentorGiorgi Dalakishvili30-Sep-08 7:55 
GeneralRe: Get FileInfo of an Audio Pin
schiebel-t1-Oct-08 6:20
schiebel-t1-Oct-08 6:20 
GeneralRe: Get FileInfo of an Audio Pin
Giorgi Dalakishvili1-Oct-08 7:41
mentorGiorgi Dalakishvili1-Oct-08 7:41 
Questionarray[key][value] Pin
nuttynibbles30-Sep-08 6:47
nuttynibbles30-Sep-08 6:47 

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.