03-05-2021 03:11 AM
Hi,
I am new to LabVIEW and approach it from a C# programming background
I create a form with a button control. When click the button the call back VI is called, but the program does not respond.
The block diagram
The call back VI
When the callback is called ,the sub VI will run and show the front panel, but the program does not respond.
Thanks in advance
Aya
03-05-2021 03:17 AM - edited 03-05-2021 03:17 AM
03-05-2021 07:39 AM
@GerdW wrote:
Does it help to close the callback reference immediately after initializing it?
I guess this is the problem. By the time the button is pressed, the callback is no longer registered. Worse, it may be registered but waiting for the garbage collector. Search the forum for "GC.Collect" and Your particular version LabVIEW version for how to handle that puzzle, if it is at all possible.
03-05-2021 09:32 AM - edited 03-05-2021 09:34 AM
Hi, @GerdW
Thanks for your fast response. I'm sorry for not clarifying the situation.
I'm a university student and I 'm involved in a high-speed bearing test bench project, in which my work is designing a software (user interface) for test bench. The user interface I need contains menu-strip and toolstrip. Like the user interface below:
I'm used to design user interface by C#. But I didn't know how design a form contains labview control.
Therefore I try to use .net design UI in labview. If you have any better idea, If you have a better idea, you are welcome to bring it up.
Thanks.
03-05-2021 12:17 PM - edited 03-05-2021 12:18 PM
LabVIEW has a range of pre-made tools that make prototyping GUIs extremely fast. Extensive programming in .NET is not fast in LabVIEW.
Making a pre-made button react to a click in LabVIEW takes about 5-10 programming actions. Changing the appearance of the button takes another 10 actions. Compare this to the roughly 100 actions it probably takes to set up the .NET callback system, which still seems to be unfinished and needs bugfixing.
If you must use .NET for some things, it is certainly possible. If you must use LabVIEW, there are more efficient options. I repeat my suggestion: Remove the event degeristration and try again. Some time after that you may notice that the callback can no longer be edited. Then do a forum search for GC.Collect.
03-05-2021 12:41 PM
Hi Tomato,
@Tomato_lover wrote:
I'm used to design user interface by C#. But I didn't know how design a form contains labview control.
Therefore I try to use .net design UI in labview. If you have any better idea, If you have a better idea, you are welcome to bring it up.
Questions:
Why do you use LabVIEW when you are familiar with C#? Why not stick with C# to design your UI? What's the point in using LabVIEW for the UI?
I don't have any experience with C#, but I guess a "form" is the same as "frontpanel element" in LabVIEW. You can design a UI in LabVIEW too, just explore all those palettes with frontpanel elements…
03-07-2021 07:45 PM - edited 03-07-2021 07:45 PM
Hi,@ LLindenbauer
Thank for your precious suggestion. Because I'm new for LabView. There are many LabView tool I 'm not familiar with. I will try my best improve my program with your suggestion or design GUI in another way.
03-07-2021 08:28 PM - edited 03-07-2021 08:48 PM
HI, GerdW
Because if I design UI by C# in Visual Studio, I just changed to a platform without LabView control and used .net to design the UI. But if I design UI in LabView, I can combine form controls and LabView controls.
In addition, my teammate whose work is signal analysis use LabView too. Therefore, I'm just afraid that these two controls cannot be combined in C#.
03-08-2021 02:35 AM
Let's stop talking about code for a moment and clarify just what is it that you hope to accomplish. Why do you feel the need to mix and match LabVIEW and .NET, for example.
03-18-2021 03:18 AM - edited 03-18-2021 03:19 AM
Hi, everyone
I'm sorry for responding so late.
My work is to design bearing test analysis software and what I want to accomplish is like the picture below:
A software UI contains menu bar ,tool bar and some LabView control such as waveform graph.
In this period of time, I find use .net container design UI running smoothly. So far, my work has progressed to this point, as shown in the figure below.
Thank for your attention and help *^_^*