|
-
Jun 22nd, 2004, 11:47 AM
#1
Thread Starter
Addicted Member
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
-
Jun 22nd, 2004, 11:55 AM
#2
Frenzied Member
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.
-
Jun 22nd, 2004, 11:59 AM
#3
Thread Starter
Addicted Member
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?
-
Jun 22nd, 2004, 12:05 PM
#4
it will call the function each time through the loop.... how else would answere get set?
TG
-
Jun 22nd, 2004, 12:10 PM
#5
Frenzied Member
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.
-
Jun 22nd, 2004, 01:36 PM
#6
PowerPoster
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|