NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with FolderBrowserDialog in c#

When I use FolderBrowserDialog functions, treview of computer doesn't appear in the window.
It works properly without TestStand but as soons as this function is executed in TestStand just the OK, Cancel,
and Create a New Folder buttons are available.
0 Kudos
Message 1 of 5
(6,779 Views)

The first thing to try for a problem like this is to put the step that displays the dialog in a subsequence. In the call to the subsequence, configure the sequence to run in a new thread and select the Edit Sequence Call>>Settings...>>Use Single-Threaded Apartment option.  You can insert a Wait step after the sequence call to keep the parent sequence from proceeding until the subsequence completes.

If this fixes it, it is because the dialog uses an ActiveX control that requires a Single-Threaded Apartment thread.

 

 

 

 

0 Kudos
Message 2 of 5
(6,770 Views)
ouahhhhh!!! It works!!! Thank you
 
The only disadvantage is that I must create another sequence,  can I directly use this step by changing his mode function or anything else?
0 Kudos
Message 3 of 5
(6,743 Views)

jambon -
All execution thread are initialized to be MTA (multi-threaded apartment) and the sequence call that you did is the only way to get an STA threading. The only other option would be to write a code module that launches a separate thread that initializes to STA and waits for the thread to complete. This is typically not as easy as just doing a sequence call.

Scott Richardson
0 Kudos
Message 4 of 5
(6,727 Views)
ok thanks for all
0 Kudos
Message 5 of 5
(6,715 Views)