EnableEvent Method (MessageBasedSessionEventType, EventMechanism)

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)

VxiSession Class See Also


Enables notification of a MessageBasedSession event.

Namespace: NationalInstruments.VisaNS

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

Syntax

Visual Basic (Declaration)
Public Sub EnableEvent ( _
	eventToEnable As MessageBasedSessionEventType, _
	mechanism As EventMechanism _
)

C#
public void EnableEvent(
	MessageBasedSessionEventType eventToEnable,
	EventMechanism mechanism
)

Parameters

eventToEnable
Type: NationalInstruments.VisaNS.MessageBasedSessionEventType
MessageBasedSession event to enable.
mechanism
Type: NationalInstruments.VisaNS.EventMechanism
Event-handling mechanism to enable.

Implements

IMessageBasedSession.EnableEvent(MessageBasedSessionEventType, EventMechanism)

Exceptions

ExceptionCondition
VisaException The NI-VISA driver returned an error as a result of calling this method.
ArgumentException

Invalid mechanism specified.

-or-

Specified event type is not supported by the resource.

DllNotFoundException The NI-VISA driver library cannot be found.
EntryPointNotFoundException A required operation in the NI-VISA driver library cannot be found.
InvalidOperationException A handler is not currently installed for the specified event.
ObjectDisposedException This member is called after the Dispose method is called directly from code or indirectly through a finalizer.

Remarks

The EnableEvent method enables notification of an event for the mechanism specified in the mechanism parameter.

Specify Queue to enable the specified session to queue events. If the specified mechanism is Queue, you must call WaitOnEvent to wait for enabled events that might have occurred. When you specify Handler, applications can enable the session to invoke a callback method to execute the handler. In order to enable events with the Handler mechanism, applications must install at least one handler.

Specify AllEnabledEvents for the eventToEnable parameter to enable all events that were previously enabled on this session. This enumeration value makes it easier to switch between the two callback mechanisms for multiple events.

See Also

Reference

VxiSession Class

NationalInstruments.VisaNS Namespace

WAS THIS ARTICLE HELPFUL?

Not Helpful