Click here to Skip to main content
15,879,535 members
Articles / Desktop Programming / WPF
Alternative
Tip/Trick

TIP: Handling WPF DialogResult with simplicity

Rate me:
Please Sign up or sign in to vote.
4.75/5 (6 votes)
18 Jun 2010CPOL 16.4K   1   4
Or even...if (frm.ShowDialog() == true){ // do something here}
Or even...

C#
if (frm.ShowDialog() == true)
{
  // do something here
}

License

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


Written By
Architect
United States United States
Since I've begun my profession as a software developer, I've learned one important fact - change is inevitable. Requirements change, code changes, and life changes.

So..If you're not moving forward, you're moving backwards.

Comments and Discussions

 
GeneralIndeed you don't have to declare a variable to evaluate the ... Pin
Jaime Olivares5-Sep-10 22:16
Jaime Olivares5-Sep-10 22:16 
GeneralWhy not "if (frm.ShowDialog())"? Pin
Simon Dufour19-Aug-10 3:22
Simon Dufour19-Aug-10 3:22 
GeneralYeah, I'm not a big fan of "if (a == true)", but at least it... Pin
Andrew Rissing29-Jun-10 3:38
Andrew Rissing29-Jun-10 3:38 
GeneralYeah, that would be equivalent to Equals(true), although it ... Pin
Jaime Olivares28-Jun-10 20:42
Jaime Olivares28-Jun-10 20:42 

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.