Click here to Skip to main content
15,891,864 members
Home / Discussions / C#
   

C#

 
QuestionHow to programmably release a virtual COM Port "In Use"? Pin
Member 30175479-Feb-10 4:15
Member 30175479-Feb-10 4:15 
AnswerRe: How to programmably release a virtual COM Port "In Use"? Pin
slebusch3-Aug-10 5:25
slebusch3-Aug-10 5:25 
QuestionHow to query WiFi access point for list of users connected to it ? Pin
blood_hl9-Feb-10 3:36
blood_hl9-Feb-10 3:36 
Questioncreating custom control that contains DialogResult [modified] Pin
sajjad.aghapouer9-Feb-10 3:21
sajjad.aghapouer9-Feb-10 3:21 
AnswerRe: creating custom control that contains DialogResult Pin
OriginalGriff9-Feb-10 4:38
mveOriginalGriff9-Feb-10 4:38 
AnswerRe: creating custom control that contains DialogResult Pin
OriginalGriff9-Feb-10 5:11
mveOriginalGriff9-Feb-10 5:11 
GeneralRe: creating custom control that contains DialogResult Pin
sajjad.aghapouer9-Feb-10 6:43
sajjad.aghapouer9-Feb-10 6:43 
GeneralRe: creating custom control that contains DialogResult Pin
OriginalGriff9-Feb-10 9:24
mveOriginalGriff9-Feb-10 9:24 
I know what you mean:

When you add a button to a form, you can set the Dialog Result in the Properties window to "OK" or "Cancel", (or "Abort", "Retry" etc.). Whe you press the button on the form, the form closes, and the Dialog result is returned to the form creator via the Form.ShowDialog method.

Unfortunately, this is specific to button, and does not work in that way for labels. They don't even have a DialogResult property! You can simulate it in code, by subscribing to the Label Click event, and setting the form DialogResult to DialogResult.OK, and that will work - but this is unusual behaviour for a Windows App, and may confuse your users. A button is more normal.

To simulate the button:
1) Create a event handler for the Label.Click event either in the properties window, or programatically in your Load event with
label1.Click += new EventHandler(label1_Click)

2) In your handler set the forms DialogResult to DialogResult.OK or DialogResult.Cancel
It will have the effect you want.
If Barbie is so popular, why do you have to buy her friends?

Eagles may soar, but weasels don't get sucked into jet engines.

If at first you don't succeed, destroy all evidence that you tried.

QuestionHow to record or capture voices from speaker or sound card on my computer win7, not from microphone Pin
serkanweb9-Feb-10 2:54
serkanweb9-Feb-10 2:54 
AnswerRe: How to record or capture voices from speaker or sound card on my computer win7, not from microphone Pin
serkanweb9-Feb-10 23:39
serkanweb9-Feb-10 23:39 
Questionregarding Microsoft Sync Framework Pin
Tridip Bhattacharjee9-Feb-10 2:47
professionalTridip Bhattacharjee9-Feb-10 2:47 
QuestionInsertMenuItem WinAPI problem Pin
Nematjon Rahmanov9-Feb-10 1:17
Nematjon Rahmanov9-Feb-10 1:17 
AnswerRe: InsertMenuItem WinAPI problem Pin
Luc Pattyn9-Feb-10 1:25
sitebuilderLuc Pattyn9-Feb-10 1:25 
QuestionRe: InsertMenuItem WinAPI problem Pin
Nematjon Rahmanov9-Feb-10 1:47
Nematjon Rahmanov9-Feb-10 1:47 
AnswerRe: InsertMenuItem WinAPI problem Pin
Covean9-Feb-10 2:08
Covean9-Feb-10 2:08 
GeneralRe: InsertMenuItem WinAPI problem Pin
Nematjon Rahmanov9-Feb-10 2:33
Nematjon Rahmanov9-Feb-10 2:33 
GeneralRe: InsertMenuItem WinAPI problem Pin
Covean9-Feb-10 2:49
Covean9-Feb-10 2:49 
GeneralRe: InsertMenuItem WinAPI problem Pin
Decco28-Feb-10 23:27
Decco28-Feb-10 23:27 
QuestionSorting Pin
sachees1238-Feb-10 23:59
sachees1238-Feb-10 23:59 
AnswerRe: Sorting Pin
monstale9-Feb-10 0:38
monstale9-Feb-10 0:38 
GeneralRe: Sorting Pin
ThatsAlok9-Feb-10 0:57
ThatsAlok9-Feb-10 0:57 
AnswerRe: Sorting Pin
ThatsAlok9-Feb-10 0:41
ThatsAlok9-Feb-10 0:41 
AnswerRe: Sorting Pin
Luc Pattyn9-Feb-10 1:01
sitebuilderLuc Pattyn9-Feb-10 1:01 
AnswerRe: Sorting Pin
Dan Mos9-Feb-10 9:09
Dan Mos9-Feb-10 9:09 
Questionhow to retrive max value of a column by using c# Pin
inayat basha8-Feb-10 23:54
inayat basha8-Feb-10 23:54 

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.