From 09:00 PM Friday, August 7 - 10:30 AM CST Saturday, August 8, will be undergoing system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DiscardEvent Method

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)

Session Class See Also

Discards event occurrences for the specified event type and mechanism in a session.

Namespace: NationalInstruments.VisaNS

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


Visual Basic (Declaration)
Public Sub DiscardEvent ( _
	customEventType As Integer, _
	mechanism As EventMechanism _

public void DiscardEvent(
	int customEventType,
	EventMechanism mechanism


Type: System.Int32
Logical event identifier.
Type: NationalInstruments.VisaNS.EventMechanism
Specifies the mechanism for which the event is to be discarded.


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

Invalid mechanism specified.


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.
ObjectDisposedException This member is called after the Dispose method is called directly from code or indirectly through a finalizer.


The DiscardEvent method discards all pending occurrences of the specified event on the queuing mechanism from the specified session. Specify 0x3FFF7FFF for the customEventType parameter to discard pending occurrences of events on all the events previously enabled on the session.

This method is useful to remove event occurrences that an application no longer needs. The discarded event occurrences are not available to the session at a later time.

Note: This method does not apply to events that have already been delivered to the application.

See Also


Session Class

NationalInstruments.VisaNS Namespace


Not Helpful