Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Examples of calling C# form/dll from Test Stand 3.5.

Do you have any examples on how to call C#.NET forms and/or DLLs from Test Stand 3.5?  I need to know the basics of how to setup a call and view Pass/Fail information.  Examples of how to return data to Test Stand from C# applications would be good to see.
 
I can add Test to the sequence file, but I need a more detailed document/examples on how to connect the two.
 
Thanks in advance.
0 Kudos
Message 1 of 12
(9,246 Views)
Hi Bobby,

When you create a step in your sequence and go to specify module. You can create that module from a template provided in TestStand. This will show how you pass data to and from TestStand. You have to do this through either a .Net Assembly or a C/C++ DLL. There are currently no C# examples in our TestStand installation or on our developer zone, but will be much the same as VB.Net examples (except for syntax of course).

Brandon Vasquez | Software Engineer | Integration Services | National Instruments
0 Kudos
Message 2 of 12
(9,235 Views)
Bobby:
 
I do this all the time... I have some examples I could give you if your still interested. Utilizing the TS API from .NET is really pretty easy once you get past some of the setup stuff.
 
Steve
0 Kudos
Message 3 of 12
(9,114 Views)

Please, if you could.  I just need simple examples to start off with ( Call and open forms created in C#.NET, How to read results ( Pass/Fail ), Read/Write to Station Globals, etc. )

Thanks in advance.

 

0 Kudos
Message 4 of 12
(9,098 Views)
Hi Bobby,

Its good that Steve is going to post some snippets for you. The
<TestStand>\examples\demo\dotnet example is a good example to look at even though its VB.NET. Also, for reference on the .NET Adapter, check out Chapter 5 of the TestStand Reference Manual.

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 5 of 12
(9,068 Views)

Bobby:

Sorry this took so long. I'm going to attach a zip file. The file contains a C# .NET 2005 project. This project creates a DLL that is called from TestStand and has a form that gets a serial number and bar code from the user. This project reads and writes variables in TestStand using the TS API. It even creates arrays, adds elements to the array and then writes information to them. Included in the zip file is a sequence file "Computer.seq". Check the PreUUT sequence for the call to the .NET assembly. Below is a very simple code snippet that sets result from a dll without the complexities of a Form Class.

If you haven't setup a project like this before spending five-ten minutes on the phone with me may save you a lot of time. If you have questions or would like to talk send me your phone number via email (Steven.McCray@tellabs.com) and I'll call you.

Steve

public

void PreUUT_Dialog_Load(SequenceContext sc)

{

PropertyObject po;

try

{

po = sc.AsPropertyObject();

po.SetValBoolean(

"Step.Result.PassFail", 0, true);

}

catch (Exception FatalError)

{

SetTestStandErrorMessage(FatalError);

}

finally

{

po =

null;

}

}

private

void SetTestStandErrorMessage(Exception FatalError)

{

PropertyObject po = SequenceContextObject.AsPropertyObject();

po.SetValString(

"Step.Result.Error.Msg", 0, FatalError.Message);

po.SetValBoolean(

"Step.Result.Error.Occurred", 0, true);

if (po != null)

po =

null;

}

0 Kudos
Message 6 of 12
(9,027 Views)

Hey,

 

Did you find any solution about testand & exe/dll?

0 Kudos
Message 7 of 12
(5,150 Views)

Yes, I sent an example that demonstrated the solution.

 

Thanks,

Steve

0 Kudos
Message 8 of 12
(5,148 Views)

Hi,

 

According to my validations in these days, I cannot find any good way to call exe files from teststand with parameters I need, but I found teststand could regonize .net dll internal function module, and teststand can also provide the channel to edit the parameters for the function module in .NET DLL.

0 Kudos
Message 9 of 12
(5,097 Views)

Hi,

 

i am new to TestStand, i want read teststand result in my C# code, guys can you please me out of this

0 Kudos
Message 10 of 12
(5,035 Views)