MessageBox

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Patrick De Ridder

    #1

    MessageBox

    I have two forms: Form1 and Form2.

    In Form2 I have an OK/Cancel MessageBox.

    I have coded

    if(result==Dial ogResult.Cancel ) Close();

    That returns the user to Form1.

    I want to return to Form2 instead of to Form1.

    Please help me by giving the statement with which to replace Close().

    Many thanks.

    --
    Patrick De Ridder
    ngmail@freeler. nl




  • Alan Gilmour

    #2
    Re: MessageBox

    Hi,

    Your description was a bit vague but can you not just use the object for
    Form1 and then call

    Form1.Close();



    Alan


    "Patrick De Ridder" <ngmail@freeler .nl> wrote in message
    news:ldbvivg81h cif5q9ttm46kebg 2trsqqr2b@4ax.c om...[color=blue]
    > I have two forms: Form1 and Form2.
    >
    > In Form2 I have an OK/Cancel MessageBox.
    >
    > I have coded
    >
    > if(result==Dial ogResult.Cancel ) Close();
    >
    > That returns the user to Form1.
    >
    > I want to return to Form2 instead of to Form1.
    >
    > Please help me by giving the statement with which to replace Close().
    >
    > Many thanks.
    >
    > --
    > Patrick De Ridder
    > ngmail@freeler. nl
    >
    >
    >
    >[/color]


    Comment

    • Patrick De Ridder

      #3
      Re: MessageBox

      On Tue, 5 Aug 2003 14:25:38 +0100, "Alan Gilmour" <a.gilmour
      nospam@locland. com> wrote:
      [color=blue]
      >Hi,
      >
      >Your description was a bit vague but can you not just use the object for
      >Form1 and then call
      >
      >Form1.Close( );[/color]

      Nope.

      Form2 is a form in which I enter data to be written away.
      At a certain point a message box appears with Ok/Cancel.
      When I press Cancel I want to return to Form 2, not to Form1.

      I know how to return to Form1 (Close() will do the trick).

      Any more suggestions?

      --
      Patrick De Ridder
      ngmail@freeler. nl

      Comment

      • Magnus Krisell

        #4
        Re: MessageBox

        Patrick,

        When you call Close() aren't you closing the form (Form2) that
        you want to return to?

        If you call MessageBox.Show () with Form2 set as owner, Form2
        will be reactivated when the message box closes. You don't need
        to call any method to close the message box itself, it will be
        automatically closed when the user clicks one of its buttons.

        I might have misunderstood the problem.

        - Magnus


        "Patrick De Ridder" <ngmail@freeler .nl> wrote in message
        news:imjviv0pio kjretmbfn8c42iv im5nsqff4@4ax.c om...[color=blue]
        > On Tue, 5 Aug 2003 14:25:38 +0100, "Alan Gilmour" <a.gilmour
        > nospam@locland. com> wrote:
        >[color=green]
        > >Hi,
        > >
        > >Your description was a bit vague but can you not just use the object for
        > >Form1 and then call
        > >
        > >Form1.Close( );[/color]
        >
        > Nope.
        >
        > Form2 is a form in which I enter data to be written away.
        > At a certain point a message box appears with Ok/Cancel.
        > When I press Cancel I want to return to Form 2, not to Form1.
        >
        > I know how to return to Form1 (Close() will do the trick).
        >
        > Any more suggestions?
        >
        > --
        > Patrick De Ridder
        > ngmail@freeler. nl[/color]


        Comment

        • Patrick De Ridder

          #5
          Re: MessageBox

          On Tue, 5 Aug 2003 20:05:15 +0200, "Magnus Krisell"
          <magkr747@NOSPA Mstudent.liu.se > wrote:
          [color=blue]
          >
          >When you call Close() aren't you closing the form (Form2) that
          >you want to return to?
          >
          >If you call MessageBox.Show () with Form2 set as owner, Form2
          >will be reactivated when the message box closes. You don't need
          >to call any method to close the message box itself, it will be
          >automaticall y closed when the user clicks one of its buttons.
          >[/color]
          I am calling the message box from within a button click handler and
          want to return to the form in which the button is placed.

          I am aware that after leaving a message box you return to the form
          proper, but that is not the problem here.

          --
          Patrick De Ridder
          ngmail@freeler. nl

          Comment

          Working...