Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i try to show message box in ok and cancel messagebox button ....
if i press ok button then ok button is do our work and when i click cancel button then operation is go back...
if u have exact answer then you solve it..
Posted
Comments
Sebastian T Xavier 9-Aug-12 2:20am    
winforms or aspx?
Mohamed Mitwalli 9-Aug-12 2:38am    
Make sure when you are posting Question you tag it right don't make people here assuming your problem this is for your good , this will help us and help you .

Microsoft has plenty of documaentation on this:
http://msdn.microsoft.com/en-us/library/ms598690%28v=vs.95%29.aspx[^]
 
Share this answer
 
Comments
_Amy 9-Aug-12 2:24am    
My +5!
Mohamed Mitwalli 9-Aug-12 2:30am    
5+ if it for windows
Is this what you are looking for?

C#
DialogResult dr = MessageBox.Show("Have you googled it?","Question",MessageBoxButtons.YesNo);
            if (dr == DialogResult.Yes)
            {
                // Do your task
            }
            else
            {
                // Exit
            }


Regards
Sebastian
 
Share this answer
 
Comments
_Amy 9-Aug-12 2:23am    
Exactly. +5!
Mohamed Mitwalli 9-Aug-12 2:30am    
5+ for windows
Sebastian T Xavier 9-Aug-12 2:35am    
Thank you
Hi ,
If it your Question for web you should see this
Display Confirmation BOX yes no on ASP.NET [^]if your Question belong to windows so i think first and 3rd solution will suit you
Best Regards
M.Mitwalli
 
Share this answer
 
v3
Comments
Prasad_Kulkarni 16-Aug-12 2:12am    
5'ed!
Mohamed Mitwalli 16-Aug-12 4:29am    
Thank you Prasad :)
Try This :

add this javascript on Button OnClientClickEvent..

e.g.:

on delete button event:

write the code on delete button event and add this javascript when button is created.
<asp:linkbutton id="btnDelete" text="Delete" runat="server" onclientclick="javascript:if(!confirm('This action will delete the selected Record,Are you sure?')){return false;}" xmlns:asp="#unknown" />

Hope this will help you...


if not, please post it.
 
Share this answer
 
Comments
_Amy 9-Aug-12 2:24am    
It's in Windows Application..
Mohamed Mitwalli 9-Aug-12 2:32am    
if it web sure 5+
Prasad_Kulkarni 16-Aug-12 2:12am    
5'ed
[no name] 16-Aug-12 5:34am    
Thanks Brother...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900