Click here to Skip to main content
15,912,932 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm making a Windows form which allows people to select a film from different genres. I've used list boxes to display the list of films and genres. When a user selects a genre, the films from that genre are displayed in another list box. The user selects a film from that list box, then a picture from the film is displayed in a picture box and informtion for the film is displayed in a text box.

Now what I want is to have button which the user clicks, once they have selected the film, which displays a message box with buttons, that asks if they're sure they want to choose this film. If the user clicks "Yes", the picture and info for the film are still displayed on screen as before. If user clicks no then the picture and info are cleared from the screen and the user can select another film.

How do I do this?
Posted

For a simple message box use the cleverly named MessageBox[^] class.

For a more complex dialog, create a new window and display it appropriately.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 27-Feb-11 12:41pm    
Enough said, my 5.
--SA
[no name] 27-Feb-11 12:52pm    
"Enough says". Then why say it.
Sergey Alexandrovich Kryukov 1-Mar-11 3:08am    
I did not understand your question "why", but I fixed spelling in my comment.
--SA
Hope this will help
if(MessageBox.Show("Your Message","Caption",MessageBoxButtons.YesNo)==DialogResult.Yes)
{
// write code here for yes
}
else
{
// here for no
}


--Pankaj
 
Share this answer
 
Comments
programmer1234 27-Feb-11 14:31pm    
This worked, thanks.
[no name] 27-Feb-11 14:58pm    
So instead of having the OP learn something you just give him the answer. Nice way to perpetuate ignorance and raise the level of our industry.

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