Opens the first card of the given type.

Namespace:  Quanser.Hardware
Assembly:  Quanser.Hardware.Hil (in Quanser.Hardware.Hil.dll)

Syntax

Visual Basic (Declaration)
Public Sub Open ( _
	cardType As String _
)
C#
public void Open(
	string cardType
)
Visual C++
public:
void Open(
	String^ cardType
)
JavaScript
function open(cardType);

Parameters

cardType
Type: System..::.String
A string identifying the type of card. For example, the string "q8" opens the first Quanser Q8 card in the system.

Examples

This sample illustrates how to use the Open(String) method. It opens the first Q8 card in the system.
C# Copy Code
try {
    Hil card = new Hil();

    /* Open the first Q8 card in the system */
    card.Open("q8");
    try {
        /* ... use card ... */

    } catch (Exception ex) {
        Console.WriteLine("Exception occurred accessing card. " + ex);
    }
    card.Close();
} catch (Exception ex) {
    Console.WriteLine("Exception occurred opening card. " + ex);
}
Visual Basic Copy Code
Try
    Dim card As New Hil()

    ' Open the first Q8 card in the system
    card.Open("q8")
    Try
        ' ... use card ...

    Catch ex As Exception
        Console.WriteLine("Exception occurred accessing card. " & ex.ToString())
    End Try
    card.Close()
Catch ex As Exception
    Console.WriteLine("Exception occurred opening card. " & ex.ToString())
End Try
Visual C++ Copy Code
try {
    Hil^ card = gcnew Hil();

    /* Open the first Q8 card in the system */
    card->Open(L"q8");
    try {
        /* ... use card ... */

    } catch (Exception^ ex) {
        Console.WriteLine(L"Exception occurred accessing card. " + ex);
    }
    card->Close();
} catch (Exception^ ex) {
    Console.WriteLine(L"Exception occurred opening card. " + ex);
}

Exceptions

ExceptionCondition
Quanser.Hardware..::.HilException If the open cannot be performed then an exception is thrown. This situtation typically arises if the requested card is not present.

See Also