In using VB to develop a project recently, I met such a problem, I want to write a piece of code, the code according to the module can be cut into three parts, the three parts using string together two variables:
At the start of the implementation code module 1 spluttered pa, performed after variable 1 is true, he started a new round of cycle at the same time; Code module 1 is true, have been waiting for 2 variables when variable 1 is true, applauded code module 2 began to clap, execution, will start to perform variable 1 become false, after execution of the variable to true; Code module 3 variables have been waiting for 2 to true, when the variable is true, 2 code module 3 also applauded began to clap, execution, will start to perform variable 2 become false, after execution of the 2 is true, then wait for variable waiting for the next round of cycle;
The three parts of the code at the time of execution, the influence of each individual independence, only at the time of complete round of execution, to detect whether the related variables to ON, convenient to the next round of execution (such as code 2 after the execution of the round, detect variable 1 is true, if it is true, started a new round of executed) The question now is, if I put three blocks of code string together, finished, if the code 1 has not yet been executed (I might have to perform to estimate code 1 1 s, because want to use more than N delay), then the code 2 will not be able to work, if you can make the code 1, 2, 3 and execution, so just after I finished my work in the code module, check whether you can start a new job, so that the machine efficiency is much higher!! Question: how to do, can let three code modules work independently?
CodePudding user response:
Now that is a code change state, use event is one of the best,
It is not necessary to polling,
The saying why didn't you listen to me,
CodePudding user response:
Use the class module, define events, raiseevent when needed
CodePudding user response:
The building Lord give points and junction post rate is very low, refueling ah