Results 1 to 6 of 6

Thread: Simple Function Questiion

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Posts
    142

    Simple Function Questiion

    If I have a function that returns a boolean(true/false) and I want to wait for the function to return the boolean BEFORE The program goes on to the next function, would something like this work??


    Code:
     
    dim answer as boolean=false
    
    'Call function getanswerdunction()
    
    answer=getanswerfunction(parameters)   'eventually returns true
    
    while answer=false
    loop
    
    nextfunction()
    or is there a better way??

    Cheers,
    Bebandit

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    Unless I'm misunderstanding you, you'd never proceed to nextfunction until you broke out of the loop. But the call to getanswerfunction needs to be in the loop. Right now it executes once, returns whatever, then goes to the while loop. If getanswerfunction returned false, you'll be stuck in an infinite loop. It'll never be true.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Posts
    142

    OK I got it...

    That's what I thought, but will putting it in the loop make it call the function over and over again?? Or will it just loop until the answer=true without calling the function over and over?

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    it will call the function each time through the loop.... how else would answere get set?

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618
    It sounds like you need to look into Threading...
    Sean

    Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.

  6. #6
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi,

    I'll take a guess here.

    If you are saying that you want to wait until the user makes a selection that changes a boolean variable, why not just use a messagebox?

    Perhaps you should tell us what changes the boolean.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

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