Click here to Skip to main content
15,894,180 members
Home / Discussions / C#
   

C#

 
AnswerRe: problem related to "Nural networks face detection algprithm" Pin
Keith Barrow31-Oct-10 2:21
professionalKeith Barrow31-Oct-10 2:21 
GeneralRe: problem related to "Nural networks face detection algprithm" Pin
inayathussaintoori1-Nov-10 11:43
inayathussaintoori1-Nov-10 11:43 
GeneralRe: problem related to "Nural networks face detection algprithm" Pin
Wes Aday2-Nov-10 4:17
professionalWes Aday2-Nov-10 4:17 
GeneralRe: problem related to "Nural networks face detection algprithm" Pin
Keith Barrow2-Nov-10 9:52
professionalKeith Barrow2-Nov-10 9:52 
QuestionAny ideas on how to do this? Pin
SledgeHammer0129-Oct-10 6:43
SledgeHammer0129-Oct-10 6:43 
AnswerRe: Any ideas on how to do this? Pin
Ian Shlasko29-Oct-10 7:02
Ian Shlasko29-Oct-10 7:02 
GeneralRe: Any ideas on how to do this? Pin
SledgeHammer0129-Oct-10 7:32
SledgeHammer0129-Oct-10 7:32 
AnswerRe: Any ideas on how to do this? Pin
phil.o29-Oct-10 7:19
professionalphil.o29-Oct-10 7:19 
Hi,

What about this piece of code ?

// In your dialog definition :
public class MyDialog : Form
{
   public SomeEnum Result { get; private set; }
   public int UserResult { get; private set; }

   // Here the code to set Result and UserResult according to your logic
   // If custom value, set Result to SomeEnum.Custom (8), and
   // set UserResult to any meaningful value.

   // Put an OK button on the form and set the AcceptButton property of the form to this button (will be in the designer file)
}

// In your main form
private void btnChoose_Click(object sender, EventArgs e)
{
   using (MyDialog dlg = new MyDialog())
   {
      (if (dlg.ShowDialog() == DialogResult.OK)
      {
         if (dlg.Result == SomeEnum.Custom)
         {
            // Put your logic here (i.e., look for the UserResult property)
         }
         else
         {
            // Put your logic here
         }
      }
   }
}


Thus, your dialog should only care to set both its properties according to your logic. Only your main form should care about values and decide what to do next, according to your particular logic.

And, if you want to store the final value in a variable in order to use it later, i'm afraid you won't have another choice than storing it to an int and doing casts from/to your SomeEnum type.
Or, you could hold two variables (one of int type and another one of SomeEnum type) and repeat your logic everytime you have to decide something from them (this part could be encapsulated in a small utility class that would hold a few methods implementing the logic).

I can't think of other solutions since I don't know what are your actual requirements/logic.

Hope this helps.

Regards.
AnswerRe: Any ideas on how to do this? Pin
Luc Pattyn29-Oct-10 7:32
sitebuilderLuc Pattyn29-Oct-10 7:32 
GeneralRe: Any ideas on how to do this? Pin
SledgeHammer0129-Oct-10 7:39
SledgeHammer0129-Oct-10 7:39 
AnswerRe: Any ideas on how to do this? Pin
Not Active29-Oct-10 8:47
mentorNot Active29-Oct-10 8:47 
AnswerRe: Any ideas on how to do this? Pin
#realJSOP29-Oct-10 9:54
mve#realJSOP29-Oct-10 9:54 
AnswerRe: Any ideas on how to do this? Pin
PIEBALDconsult29-Oct-10 15:56
mvePIEBALDconsult29-Oct-10 15:56 
QuestionJust A Thought - Interface = I, Abstract = A Pin
Jammer29-Oct-10 4:10
Jammer29-Oct-10 4:10 
AnswerRe: Just A Thought - Interface = I, Abstract = A PinPopular
J4amieC29-Oct-10 4:16
J4amieC29-Oct-10 4:16 
GeneralRe: Just A Thought - Interface = I, Abstract = A Pin
Ennis Ray Lynch, Jr.29-Oct-10 8:15
Ennis Ray Lynch, Jr.29-Oct-10 8:15 
AnswerRe: Just A Thought - Interface = I, Abstract = A Pin
_Erik_29-Oct-10 4:21
_Erik_29-Oct-10 4:21 
AnswerRe: Just A Thought - Interface = I, Abstract = A Pin
T M Gray29-Oct-10 10:39
T M Gray29-Oct-10 10:39 
GeneralRe: Just A Thought - Interface = I, Abstract = A Pin
Pete O'Hanlon29-Oct-10 11:04
mvePete O'Hanlon29-Oct-10 11:04 
AnswerRe: Just A Thought - Interface = I, Abstract = A Pin
PIEBALDconsult29-Oct-10 18:05
mvePIEBALDconsult29-Oct-10 18:05 
AnswerRe: Just A Thought - Interface = I, Abstract = A Pin
Abhinav S30-Oct-10 18:19
Abhinav S30-Oct-10 18:19 
GeneralRe: Just A Thought - Interface = I, Abstract = A Pin
thatraja1-Nov-10 21:18
professionalthatraja1-Nov-10 21:18 
QuestionSending parameters to an appilcation if it is open. Pin
TheFoZ29-Oct-10 2:53
TheFoZ29-Oct-10 2:53 
QuestionKeys and Disabling Pin
SRJ9229-Oct-10 2:11
SRJ9229-Oct-10 2:11 
AnswerRe: Keys and Disabling Pin
OriginalGriff29-Oct-10 2:18
mveOriginalGriff29-Oct-10 2:18 

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.