From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

event structure cannot combine with other event and only run one time

Solved!
Go to solution

Why It will always stuck when i Combine the "add new user" Event to the "Login" Event ??

It work for me when i separate two but "add new user"button can run but only one time for the above structure,program will stuck on the second time i press the "add new user"button

test.PNG

0 Kudos
Message 1 of 9
(3,102 Views)

Anyone?

0 Kudos
Message 2 of 9
(3,088 Views)
I don't see anything done correctly. You should have one event structure with multiple events. You're event structure needs to be inside a while loop. Don't use the run continuous nutrition. Don't use local variables. You have a classic race condition.
0 Kudos
Message 3 of 9
(3,058 Views)

 

When i combine the "add new user"event to the "login"event ,the whole front panal stuck when i pressed "add new user"button

why would it happen?

0 Kudos
Message 4 of 9
(3,048 Views)
Are you sure the login event has finished? Attach a VI with the correct design pattern.
0 Kudos
Message 5 of 9
(3,037 Views)

can u please hint me how should i suppose to do it ? im not sure where is wrong

0 Kudos
Message 6 of 9
(3,035 Views)
Solution
Accepted by topic author gary333

It was already told you, you should use only one Event structure and not 2. Also, avoid using local variables (better to store data in a shift register, and not in an indicator) how you do, it can cause nasty race conditions.

Actually here you just do not need other data storage since you have a file. Do not store data file in the root of the C drive, you may not have write permission. Use Default Data folder or the application folder.

I have attached a simple example. I guess this is a homework? Please make my help count: try to understand why your VI does not work, and try to find a solution by yourself. Modify my example, and play with it. This is how you can learn LabVIEW. If something is not clear, post here, and we can explain/help.

 

edit: at the "login" Event case, I do not check against whether the file exists or not. Fix this part, also gives some practice.

Message 7 of 9
(3,018 Views)

Thank you~

Im sorry bcos i dont understand just now...

Thanks for your sample

this is much appreciated.

0 Kudos
Message 8 of 9
(2,997 Views)

If you don't understand the answer that was given, you're in WAY over your head and the example won't really help you too much.  Instead of trying to push forward, take a few steps back.  Learn about LabVIEW.  Take free tutorials.  THEN, try to do what you'd like to program.

0 Kudos
Message 9 of 9
(2,972 Views)