04-15-2024 11:59 AM
You're saying "switch to another VI" but that's not how LabVIEW works. If you're coming from another language I can kind of understand the confusion, where you might tell the program to close one form and open another, but that's not what you do in LabVIEW.
In LabVIEW, a VI is both the interface (front panel) and the code (block diagram). The block diagram cannot contain an instruction that means "switch to another VI".
To do what you want, you need to set up your code in one of three ways.
Way #1: Main VI, with subVIs as popups
Run one main VI. Have a subVI in it that shows your login window. When the login window is done, it outputs its results, and the main VI then either displays the next subVI as a popup, or whatever else should happen if it fails.
Way #2: Hide login panel, open subVI popup
When the login is done, tell your VI to hide itself and then run another subVI to launch itself as a popup.
Way #3: Change your front panel, no popups
Set up your front panel in such a way that you see the login portion of it at the start, and when that succeeds it changes its appearance to do the next things it needs to do.
For example, you could set up a tab control, hide the tabs from the user so they can't change them, and have one tab be the login tab and the other be the main program. If the user logs in right, you programmatically change the tab.
Or you could just use a bunch of controls stacked on top of each other, and use the "Visible" properties of each to show or hide them.
Or you could turn off scroll bars and resizing while running, and change the front panel's "origin" property to move around to different sections of the panel to make it look like the VI changes but it's actually the same VI.
04-15-2024 12:00 PM
Hi shreyaskarnad,
@shreyaskarnad wrote:
how to switch to another VI if the login details are correct
I repeat: use a case structure with your "another VI" as subVI in one of the cases!
04-16-2024 08:34 AM
I love you man! IT WORKS! Thank you so much!!!
04-16-2024 09:15 AM
Ok so I was able to get the subvi to open but now the problem is it is opening the subvi even if I enter wrong credentials. I am attaching the VI in the details. Can you please help?
04-16-2024 01:58 PM
Hi shreyaskandar,
@shreyaskarnad wrote:
Ok so I was able to get the subvi to open but now the problem is it is opening the subvi even if I enter wrong credentials.
Right now your "Login" VI is not executable because of a missing wire!
You need to wire a condition to the case structure…
04-16-2024 02:01 PM
Yes I got that thing working. But what the next hurdle is I am not able to switch to the 3rd subVI. That subVI contains a MATLAB node for executing a MATLAB code. Both the methods - SubVI and Tab switch are not working. When I click the switch button on second tab and second SubVI to switch to 3rd page or 3rd SubVI, it just hangs and doesn't go anywhere. Attaching the file for your reference
04-16-2024 02:29 PM
Hi shreyaskandar,
@shreyaskarnad wrote:
Attaching the file for your reference
Why don't you cleanup that code! It's really horrible!
(And way too large…)
@shreyaskarnad wrote:
When I click the switch button on second tab and second SubVI to switch to 3rd page or 3rd SubVI, it just hangs and doesn't go anywhere.
You can resolve any DATAFLOW problem by using debugging tools like highlight execution!
(Cleaning up the code really helps to follow DATAFLOW while debugging…)
Hint: When does a loop iterate? Answer: Accordin to DATAFLOW as soon as the code inside the loop is executed!
Question: when is the code inside your outer while loop is finished?
04-17-2024 12:26 AM - edited 04-17-2024 12:31 AM
I had kept the outer loop only to keep the program running until I click close button which was supposed to be on page 3. But the thing is the moment I remove MATLAB node the program works like charm. But when I add it back it hangs. Why is this happening? It's really frustrating that LabVIEW doesn't have any function to switch to other VI without this tabs and subvi stuff! Anyway, I'll figure out something thanks.
04-17-2024 01:04 AM - edited 04-17-2024 01:22 AM
Hi shreyaskandar,
@shreyaskarnad wrote:
I had kept the outer loop only to keep the program running until I click close button which was supposed to be on page 3.
When you don't understand the term "Think DATAFLOW!" then you should take the training resources offered at the top of the LabVIEW board to learn LabVIEW basics.
Putting loops inside loops (like you did) shows missing basics knowledge…
@shreyaskarnad wrote:
But the thing is the moment I remove MATLAB node the program works like charm. But when I add it back it hangs. Why is this happening?
When I "remove the MATLAB node" then the VI is shown "broken" and so not able to execute. I don't know how you "remove the MATLAB node" and still keep your VI running…
@shreyaskarnad wrote:
It's really frustrating that LabVIEW doesn't have any function to switch to other VI without this tabs and subvi stuff!
Right now you have only ONE VI, there is nothing to "switch to other VI". All you can do (and this would be very easy) is to switch tabs of a tab container.
Recommendation: to solve programming problems it really helps to ask the right questions, using the correct wording. As you can see from my comments your wording is very unclear/misleading…
Edit:
I attached a simple (very, very simple) VI to show how to switch tabs programmatically…