Click here to Skip to main content
15,901,373 members
Home / Discussions / C#
   

C#

 
JokeRe: MessageBox is displayed twice.... Help! Pin
Vikram A Punathambekar2-Apr-09 0:21
Vikram A Punathambekar2-Apr-09 0:21 
GeneralRe: MessageBox is displayed twice.... Help! Pin
J4amieC2-Apr-09 0:24
J4amieC2-Apr-09 0:24 
AnswerRe: MessageBox is displayed twice.... Help! Pin
King Julien2-Apr-09 0:12
King Julien2-Apr-09 0:12 
GeneralRe: MessageBox is displayed twice.... Help! Pin
Rajdeep.NET is BACK2-Apr-09 0:21
Rajdeep.NET is BACK2-Apr-09 0:21 
GeneralRe: MessageBox is displayed twice.... Help! Pin
J4amieC2-Apr-09 0:26
J4amieC2-Apr-09 0:26 
GeneralRe: MessageBox is displayed twice.... Help! Pin
Vikram A Punathambekar2-Apr-09 0:26
Vikram A Punathambekar2-Apr-09 0:26 
AnswerRe: MessageBox is displayed twice.... Help! Pin
J4amieC2-Apr-09 0:31
J4amieC2-Apr-09 0:31 
AnswerRe: MessageBox is displayed twice.... Help! Pin
J4amieC2-Apr-09 0:32
J4amieC2-Apr-09 0:32 
EDIT: The post above messed up not showing half the text. I have reposted here without the long code blocks

In the interest of killing this question I will now provide you with the answer. Ready? Concentrate now...

you have told the computer to show you two message boxes.. look...
MessageBox.Show("Are you sure to exit the application!....

if (MessageBox.Show("Are you sure to exit the application! .... 


The first one you show the message box and discard the user's response.

The second one is within an if(..) construct. This does a boolean check on the contents of the (..) and if that returns true then the code directly after fires. Otherwise the code inside the else part executes. You would have learnty this had you have sat in on lecture "programming 101".

Your if(..) checks that the users response is equal to DialogResult.OK (or, more simply the user clicks trhe OK button) and if they do then the app closes. The part in your else is irrelevant.

Good luck with the rest of your career, mine'll be a big mac with fries please.
GeneralRe: MessageBox is displayed twice.... Help! Pin
Michael Bookatz2-Apr-09 1:06
Michael Bookatz2-Apr-09 1:06 
GeneralRe: MessageBox is displayed twice.... Help! Pin
Pete O'Hanlon2-Apr-09 1:37
mvePete O'Hanlon2-Apr-09 1:37 
AnswerRe: MessageBox is displayed twice.... Help! Pin
musefan2-Apr-09 2:37
musefan2-Apr-09 2:37 
AnswerRe: MessageBox is displayed twice.... Help! Pin
0x3c02-Apr-09 6:00
0x3c02-Apr-09 6:00 
Questiondatagridview DataPropertyName Problem Pin
Nitin K2-Apr-09 0:02
Nitin K2-Apr-09 0:02 
QuestionThread.Sleep() Pin
yesu prakash1-Apr-09 23:55
yesu prakash1-Apr-09 23:55 
AnswerRe: Thread.Sleep() Pin
12Code2-Apr-09 0:03
12Code2-Apr-09 0:03 
AnswerRe: Thread.Sleep() Pin
Megidolaon2-Apr-09 0:53
Megidolaon2-Apr-09 0:53 
AnswerRe: Thread.Sleep() Pin
musefan2-Apr-09 2:43
musefan2-Apr-09 2:43 
GeneralRe: Thread.Sleep() Pin
yesu prakash2-Apr-09 19:19
yesu prakash2-Apr-09 19:19 
Question[Message Deleted] Pin
Rajdeep.NET is BACK1-Apr-09 23:55
Rajdeep.NET is BACK1-Apr-09 23:55 
AnswerRe: Help needed again....MessageBox pops up Twice! Pin
12Code1-Apr-09 23:59
12Code1-Apr-09 23:59 
GeneralRe: Help needed again....MessageBox pops up Twice! Pin
Rajdeep.NET is BACK2-Apr-09 0:09
Rajdeep.NET is BACK2-Apr-09 0:09 
GeneralRe: Help needed again....MessageBox pops up Twice! Pin
12Code2-Apr-09 0:17
12Code2-Apr-09 0:17 
GeneralRe: Help needed again....MessageBox pops up Twice! PinPopular
J4amieC2-Apr-09 0:11
J4amieC2-Apr-09 0:11 
AnswerRe: Help needed again....MessageBox pops up Twice! Pin
King Julien2-Apr-09 0:06
King Julien2-Apr-09 0:06 
QuestionHow do i Create a simple HTTP web server in C# ? Pin
sportsonpc1-Apr-09 23:02
sportsonpc1-Apr-09 23:02 

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.