LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using .net to design the user interface, the program does not respond when the button is clicked

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

image.png

 

The call back VI

image.png

 

When the callback is called ,the sub VI will run and show the front panel, but the program does not respond.

image.png

 

Thanks in advance

 

Aya

0 Kudos
Message 1 of 10
(522 Views)

Hi Tomato,

 

why do you need to create that button using .Net? Why not use a plain LabVIEW button with an event structure?

 

Does it help to close the callback reference immediately after initializing it?

Best regards,
GerdW


using LV2016/2019/2020 on Win8.1/10+cRIO
0 Kudos
Message 2 of 10
(517 Views)

@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.

0 Kudos
Message 3 of 10
(469 Views)

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:

Tomato_lover_0-1614957935335.png

 

 

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.

 

 

0 Kudos
Message 4 of 10
(452 Views)

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.

0 Kudos
Message 5 of 10
(442 Views)

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…

Best regards,
GerdW


using LV2016/2019/2020 on Win8.1/10+cRIO
0 Kudos
Message 6 of 10
(438 Views)

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.

 

 

0 Kudos
Message 7 of 10
(413 Views)

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#.

0 Kudos
Message 8 of 10
(407 Views)

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.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 10
(382 Views)

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:

Tomato_lover_0-1616052550809.png

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.

 

Tomato_lover_1-1616055218665.png

 

 

Thank for your attention and help *^_^*

0 Kudos
Message 10 of 10
(249 Views)