Open Method (String, AccessModes, Int32)

NI-VisaNS .NET Class Library Help for Visual Studio 2010

Edition Date: August 2012

Part Number: 370627F-01

»View Product Info
Download Help (Windows Only)

ResourceManager Class See Also


Initializes a new instance of a subclass of Session from the specified resource name, access mode, and timeout.

Namespace: NationalInstruments.VisaNS

Assembly: NationalInstruments.VisaNS (in NationalInstruments.VisaNS.dll) Version: 13.0.40.167

Syntax

Visual Basic (Declaration)
<SecurityPermissionAttribute(SecurityAction.Demand, Flags := SecurityPermissionFlag.UnmanagedCode)> _
Public Function Open ( _
	resourceName As String, _
	accessMode As AccessModes, _
	openTimeout As Integer _
) As Session

C#
[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
public Session Open(
	string resourceName,
	AccessModes accessMode,
	int openTimeout
)

Parameters

resourceName
Type: System.String
String that describes a unique VISA resource.
accessMode
Type: NationalInstruments.VisaNS.AccessModes
The mode by which the specified VISA resource is accessed.
openTimeout
Type: System.Int32
The maximum time in milliseconds that this statement waits to open a VISA session with the specified resource name. This parameter does not set the Timeout property.

Return Value

A new instance of a subclass of Session.

Exceptions

ExceptionCondition
VisaException There are problems opening a VISA session to resourceName.
ArgumentException

Insufficient location information, or the device or resource is not present in the system.

-or-

Invalid accessMode.

-or-

The interface type is valid, but the specified interface number is not configured.

-or-

The type that this method should instantiate cannot be determined.

DllNotFoundException The NI-VISA driver library cannot be found.
EntryPointNotFoundException A required operation in the NI-VISA driver library cannot be found.

Remarks

This method instantiates the correct subclass based on the resourceName. For example, if you set resourceName to "GPIB0::2::INSTR", the Open method instantiates a GpibSession object. Likewise, if you set resourceName to "TCPIP::MyComputerName::7::SOCKET", the Open method instantiates a TcpipSocket object.

.NET Framework Security

See Also

Reference

ResourceManager Class

NationalInstruments.VisaNS Namespace

WAS THIS ARTICLE HELPFUL?

Not Helpful