Click here to Skip to main content
15,902,774 members
Home / Discussions / C#
   

C#

 
QuestionLoading data from selected row in datagridview into dialog box Pin
Martin310882-Apr-09 0:25
Martin310882-Apr-09 0:25 
AnswerRe: Loading data from selected row in datagridview into dialog box Pin
Henry Minute2-Apr-09 1:15
Henry Minute2-Apr-09 1:15 
GeneralRe: Loading data from selected row in datagridview into dialog box Pin
Martin310882-Apr-09 2:07
Martin310882-Apr-09 2:07 
GeneralRe: Loading data from selected row in datagridview into dialog box Pin
Henry Minute2-Apr-09 2:37
Henry Minute2-Apr-09 2:37 
GeneralRe: Loading data from selected row in datagridview into dialog box Pin
Martin310882-Apr-09 23:15
Martin310882-Apr-09 23:15 
GeneralRe: Loading data from selected row in datagridview into dialog box Pin
Henry Minute3-Apr-09 2:55
Henry Minute3-Apr-09 2:55 
GeneralRe: Loading data from selected row in datagridview into dialog box Pin
Martin310883-Apr-09 3:44
Martin310883-Apr-09 3:44 
QuestionMessageBox is displayed twice.... Help! Pin
Rajdeep.NET is BACK2-Apr-09 0:05
Rajdeep.NET is BACK2-Apr-09 0:05 
Hi Guys,

I am working on a Windows Form where I have placed a Button control (Button text: Exit). In the Button1_Click event Handler, I have added this code:

//Code begins here

private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("Are you sure to exit the application! Selct Ok to Exit now or Cancel to stay in the current form", "Sample App", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);

if (MessageBox.Show("Are you sure to exit the application! Selct Ok to Exit now or Cancel to stay in the current form", "Sample App", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK)
{
Close();
}
else
{
return;
}
}

//Code ends here


However, when I debug the solution and click on the Exit button, the Message Box is displayed asking for confirmation. Then, when I click on the Ok button, instead of closing the application, the same Message Box pops up again! Then, again I have to click on Ok and this time the Click Event executtes and the application closes. Similar is the case with the Cancel Button. Why does the MessageBox display the same message twice? Help me Please....

Your help will be appreciated. Thanx....
AnswerRe: MessageBox is displayed twice.... Help! Pin
J4amieC2-Apr-09 0:09
J4amieC2-Apr-09 0:09 
GeneralRe: MessageBox is displayed twice.... Help! Pin
MumbleB2-Apr-09 0:12
MumbleB2-Apr-09 0:12 
GeneralRe: MessageBox is displayed twice.... Help! Pin
Spunky Coder2-Apr-09 2:02
Spunky Coder2-Apr-09 2:02 
GeneralRe: MessageBox is displayed twice.... Help! Pin
Rajdeep.NET is BACK2-Apr-09 0:15
Rajdeep.NET is BACK2-Apr-09 0:15 
GeneralRe: MessageBox is displayed twice.... Help! Pin
J4amieC2-Apr-09 0:19
J4amieC2-Apr-09 0:19 
GeneralRe: MessageBox is displayed twice.... Help! Pin
Dan Neely2-Apr-09 3:20
Dan Neely2-Apr-09 3:20 
RantRe: MessageBox is displayed twice.... Help! Pin
Vikram A Punathambekar2-Apr-09 0:23
Vikram A Punathambekar2-Apr-09 0:23 
GeneralRe: MessageBox is displayed twice.... Help! Pin
Colin Angus Mackay2-Apr-09 0:36
Colin Angus Mackay2-Apr-09 0:36 
GeneralRe: MessageBox is displayed twice.... Help! Pin
akyriako782-Apr-09 2:06
akyriako782-Apr-09 2:06 
GeneralRe: MessageBox is displayed twice.... Help! Pin
HuntingWabbits2-Apr-09 2:51
HuntingWabbits2-Apr-09 2:51 
GeneralRe: MessageBox is displayed twice.... Help! Pin
akyriako782-Apr-09 2:07
akyriako782-Apr-09 2:07 
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 

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.