LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help me find System.Windows.Forms Application.enablevisualstyles in Labview

Hello all, I am trying to program a dot net marquee-style progress bar in a labview 2021 project.   While I can place the progress bar, it doesn't animate in Labview 2021, but it will in 2018.   Digging deeply into the internet, I think it is related to a setting/method in dot net called Application.EnableVisualStyles.    Of course it could be something else, but this seems to make sense.  Has anybody else ever been able to execute that method?   I can't find where it is exposed, but dot net documentation says it is part of System.Windows.Forms.

 

All I want is my progress bar code that works in 2018 to also work in 2021.

 

Chances are that the vi below will work on your LabVIEW installation.   It doesn't on my 2021.

0 Kudos
Message 1 of 6
(411 Views)

Have you tried to force the VI run in UI thread?

From VI property => Execution => Preferred Execution System => user interface.

 

George Zou
0 Kudos
Message 2 of 6
(393 Views)

By sheer luck I do have both those versions installed and I can confirm that it works on 2018 but not on the 2021.

 

I did have no problem finding Application.EnableVisualStyles though.

 

How did you attempt to reach that?  I get it via the following:

 

  1. Place an invoke node
  2. Right-click, choose Select Class ► .NET ► Browse...
  3. Locate System.Windows.Forms (4.0.0.0) in the "Assembly" dropdown
  4. In the "Objects" section, find and expand the "System.Windows.Forms" section
  5. Scroll down about one page to find Application, select it, then click OK
  6. Click on the node to bring up the selection menu, and find [S]EnableVisualStyles(), select that

 

If that's what you did, which of those steps can't be done?

 

Also, I did try running that and it didn't seem to help the progress bar work.  Maybe that's part of it but other things also need to happen, or maybe it's just permanently broken due to some sort of internal change in LabVIEW 2021.

0 Kudos
Message 3 of 6
(381 Views)

It works on a coworker's labview 2021.   Just mine and yours are broken I guess.  Thanks for walking me to the application object.  I bounced all around and never found it until you laid it out for me. 

0 Kudos
Message 4 of 6
(373 Views)

That did not work.  

0 Kudos
Message 5 of 6
(372 Views)

@dudenohair wrote:

It works on a coworker's labview 2021.   Just mine and yours are broken I guess.  Thanks for walking me to the application object.  I bounced all around and never found it until you laid it out for me. 


By chance does your co-worker have a "LabVIEW.exe.config" file created for 2021?

 

Having something like that set up which could be used to change the .NET environment somehow is the main thing I can think of that would differentiate between the same install on 2 different PCs.

 

The only other thing I can think of is if maybe your co-worker runs unpatched 2021 but you have SP1 f2, or something like that.

0 Kudos
Message 6 of 6
(357 Views)