EndReadString 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)

VxiSession Class See Also


Handles the end of an asynchronous read and returns the ASCII-encoded read string.

Namespace: NationalInstruments.VisaNS

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

Syntax

Visual Basic (Declaration)
Public Function EndReadString ( _
	asyncResult As IAsyncResult _
) As String

C#
public string EndReadString(
	IAsyncResult asyncResult
)

Parameters

asyncResult
Type: System.IAsyncResult
An asynchronous result that represents the asynchronous read operation that you want to end.

Return Value

A string that contains the read data.

Implements

IMessageBasedSession.EndReadString(IAsyncResult)

Exceptions

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

asyncResult has already ended.

-or-

asyncResult is not a read.

-or-

asyncResult did not originate from VisaNS.

ArgumentNullException asyncResult is null (Nothing in Visual Basic).
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.

Remarks

Call this method to wait for an asynchronous read started with BeginRead. This method blocks execution of the current thread until the read completes or a timeout occurs. If you passed a callback to BeginRead, call this method inside of the callback.

If you need to read string data in an encoding other than ASCII, such as Unicode, use EndReadByteArray to read the data. Then call the Encoding class to convert the byte array to a string.

Note: In order to free resources associated with the read, you must always call EndReadString or EndReadByteArray after you call BeginRead, whether in the callback given to BeginRead or in the same thread of execution where BeginRead was called.

See Also

Reference

VxiSession Class

NationalInstruments.VisaNS Namespace

WAS THIS ARTICLE HELPFUL?

Not Helpful