03-26-2022 05:43 PM
I want to be able to calculate the side of any right triangle and be able to clear out the controls if all are filled. I have done this but with my code, I have to run the program again to clear it. I know I could set it so all fields are cleared by pressing a button, but is there a way to do it without pressing one?
Also is there a way to clear one of the controls if the other 2 are filled?
Solved! Go to Solution.
03-26-2022 05:52 PM
You should look at using an Event Structure to handle when your controls change values. You could even have a button for clearing the values.
03-26-2022 10:02 PM - edited 03-27-2022 12:23 AM
@Net2022 wrote:
I want to be able to calculate the side of any right triangle and be able to clear out the controls if all are filled. I have done this but with my code, I have to run the program again to clear it. I know I could set it so all fields are cleared by pressing a button, but is there a way to do it without pressing one?
see ow far you get.
03-26-2022 11:43 PM - edited 03-27-2022 12:30 AM
Thank you for your help, I'm only in the beginning stages of learning.
03-27-2022 12:25 AM
I tried using event structure, but I think my code is still is a problem.
03-27-2022 12:31 AM
@Net2022 wrote:
Thank you for your help, I'm only in the beginning stages of learning.
You really need to start with the tutorials. None of your code is reasonable and again, virtually none of your local variables are needed. You need to understand the magic of the dataflow paradigm.
See if the attached makes any sense. Look up the functions used and try to understand the logic.
(A good program should have input validation and error handling (e.g. Hypot... need to be larger than side1 or side 2, resp. Inputs need to be valid numbers, etc.).
03-27-2022 01:12 AM
Thanks for your help. What you did makes sense. Looking at how you did it, I used some components that were similar to yours but wasn't able to get the correct results so I tried the way I posted. If I understand correctly (%.3f) gives how many significant digits after the integer? Why does it not work if it's there? Is it because 2 different inputs are going into the string?
I see where I was going wrong was in trying to use T/F for everything. It's complicated yet so simple. Thank you for your guidance. I'm going to see if I can tweak mine to make it more logical like yours.
03-27-2022 01:49 AM
@Net2022 wrote:
If I understand correctly (%.3f) gives how many significant digits after the integer? Why does it not work if it's there? Is it because 2 different inputs are going into the string?
You sentence makes absolutely no sense.
What is "it" that's there and what do you mean by "not work"? What inputs go into what string? Where?
Please clarify.
03-27-2022 02:00 AM
I thank you for your help, but your reply sounds a little rude. I'm not trying to be a bother. I'm just trying to learn. To clarify I was asking about the (%.3f) that is in the string array containing the words side 1 is.. In order to understand the code, I recreated it and when the (%.3f) was left off the end the VI didn't run. I was trying to understand why the (%.3f) is needed.
03-27-2022 02:10 AM - edited 03-27-2022 02:23 AM
I wasn't rude, just did not understand what you are saying.
I cannot see what you wired where and words are insufficient to tell what you are doing wrong. There are millions of possibilities why something does not work. (wrong result, broken run button, computer crashes, etc.)
Is it possible that you wired the format to the wrong input of the format string operation? Compare with my example.