Results 1 to 8 of 8

Thread: Wait for return value

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    683

    Resolved Wait for return value

    I have a form and what it does right now is when the user clicks the add button, a second form opens asking for how many copies. When the user chooses a number and clicks the button on that form it closes and returns a value. But in the sub that calls the second form, I want it to now continue with the code until the second form has closed and a value has returned so I can use the value in the code after. Is this possilble?
    Last edited by Beast777; Jun 18th, 2007 at 01:06 PM.

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Wait for return value

    Show the popup form using ShowDialog() and it will block the calling method until the form is closed (set its DialogResult property to indicate the returned value, or add your own property).

  3. #3
    Addicted Member
    Join Date
    Sep 2004
    Posts
    185

    Re: Wait for return value

    penagate is right. Here is a link to a thread where I asked a similar question and there is some example code...

    http://www.vbforums.com/showthread.php?t=470000

  4. #4
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Wait for return value

    I want it to now continue with the code until the second form has closed and a value has returned so I can use the value in the code after
    That can't happen if I understood correctly
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Wait for return value

    I think the OP meant "not" rather than "now".

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    683

    Re: Wait for return value

    Yes sorry not is correct. Thank you all for the posts.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    683

    Re: [RESOLVED] Wait for return value

    Can you have a showdialog to open a new form, and within it also have another showdialog? I cannot seem to get it to work.

  8. #8
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Wait for return value

    Yeah you can. Pretty straightforward. Show your code, you might be doing something wrong. And you might be getting an error. And it might be helpful if you told us what the error is

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