CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Dialog result

  1. #1
    Join Date
    Jul 2002
    Posts
    146

    Dialog result

    Hi all,
    I have a button in a form that has associated a DialogResult = OK.
    When I press the button I perform some check and in case I don't wont to exit to the form .
    I don't want to process the button click....

    Thanks

  2. #2
    Join Date
    May 2007
    Location
    Denmark
    Posts
    623

    Re: Dialog result

    I've always found it easiest to control this kind of thing manually. I'd do something like this:

    Code:
    private void button1_Click(object sender, EventArgs e)
    {
       this.DialogResult = DialogResult.None;
       if(something)
          this.DialogResult = DialogResult.OK;
    }
    For this to work, you also need to set the button's DialogResult property to None in the designer.
    It's not a bug, it's a feature!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured