Thursday, June 2, 2011

Visual basic, how to pause a function while waitin for a button to be clicked in a GUI?

Ok, I am working on a problem where I need to get multiple numebrs from the user, multiple differnt times, it is a recursive thing...

What I am doing specifically is a mobiles problem, Which is a string, with a strut and 2 weights, or more mobiles, and there can be multiple mobiles.



My problem is, in doing this the first time the user clicks the submit button, it needs to take the answers he gave me and call the recursive function, now that recursive function is going to call itself, getting more values from the user, the problem is, it doesnt get more values from the user, it just gets stuck in an infiite loop because it uses the current values (it was no reason to wait for the user to change his values and hit submit again) so how can i make it so that the function stops, and waits for the new values to be entered and submit to be pressed again, before attepting to call itself again?Visual basic, how to pause a function while waitin for a button to be clicked in a GUI?
let the function copy the current values into a second varible, blank the first variable, then start again.Visual basic, how to pause a function while waitin for a button to be clicked in a GUI?
You can put a button check function in your recursive function. At the beginning of the your execution, your Go button display, and your %26quot;Input%26quot; button is disable and invisible. After the first input with %26quot;Go%26quot;, the %26quot;Go%26quot; button becomes disable and invisible, and the %26quot;Input%26quot; button enabled. Set a static value in %26quot;Input%26quot; button (in case you need more inputs using i++ will do it), the value will be ready whenever the recursive function like to check it. If the value of the Input changed, the recursive function will call you value read function (this may add a value to your array), then comes back to complete the execution of your recursive function. Hope this would help!