From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

Showing results for 
Search instead for 
Did you mean: 

Are there any new manuals covering .NET commands since the 2006 answer?

Are there any new manuals covering .NET commands since the 2006 answer?
Are examples written in .NET available in a seperate group?
Is there a search string available for finding .NET code samples?
Is it possible to search the actual source of all the samples for .NET commands?

Specific Question: What is the proper use of .EndWrite(IASyncVariable) in conjunction with .BeginWrite?


The code below works but since I don't understand the code I'm not sure it will work in production. 

(Note:My actual "intended for production code" includes more timeout related code.)


Private Sub btnMakeItSo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMakeItSo.Click

Dim IASync As IAsyncResult
IASync = GPIB.BeginWrite(RangeCmdTextBox.Text)
Loop Until IASync.IsCompleted
'What role should GPIB.EndWrite(IASync) play in conjunction with the BeginWrite command?

End Sub



0 Kudos
Message 1 of 4

I am not sure what you mean by 2006 answer.


You can find .net examples by going to start>>programs>>national instruments>>NI-488.2>>examples, so long as you installed that support along with the 488.2 driver.


As for .NET commands, they should be listed in the measurement studio help. For example, from that help document:


EndWrite. : Call this method to wait for completion of an asynchronous write started with BeginWrite. This method blocks execution of the current thread until the asynchronous write that you are waiting on completes.

Note In order to free resources associated with the write, you must always call EndWrite after calling BeginWrite, whether in the callback given to BeginWrite or in the same thread of execution where BeginWrite was called.
0 Kudos
Message 2 of 4

Sorry about the 2006 reference--In my search of NI one response had the remark that documentation on NI-488.2 .Net software was sparse.  Among tens of thousands of forum interchanges this may be some sort of record for being cryptic.


I was hoping that there was some documentation giving a model of what each command of the configurewrite-beginwrite-endwrite commands did behind the scenes in terms of activity in the .net code(called from Visual Basic 2008), the NI488 board and the actual bus.  In the code in my message, I have had the EndWrite statement hang even though the IASync reported IsCompleted True.  Using EndWrite(BeginWrite) construction, so far, has not hung.


Your quotes from Measurement Studio are helpful but we don't have it at this lab.   Does Measurement Studio help go in further depth than your quotes?  And is purchase of Measurement Studio the only way to get this documentation?


Thanks for your help.


0 Kudos
Message 3 of 4

A note about our forums--sometimes it is actually better to search google for a string, like "measurement studio function reference" than it is to use our internal search. That may alleviate future frustration on other topics.


This KB may be of assistance to you:

It is a little out of date, but the article and the related links seem like they may be helpful.


As far as I am aware, there is no way to get those help files--they seem to be a feature of the product. However if you have the help on a different computer, you can take the help files off of that computer and you may be able to view them using the h2 viewer:

or you could try out measurement studio for 30 days, if you are interested:


However, the help does sometimes seem to be more detailed than that quote. For example, read status byte has the following documentation:

"For a session to a Serial device or Ethernet socket, if IOProtocol is set to Protocol4882, the string, "*STB?\n", is sent to the device, and the device status byte is read; otherwise, this method is not valid. If the status information is only one byte long, the most significant byte is returned with the zero value. If the service requester does not respond in the actual timeout period, a VisaException is thrown with an error code of ErrorTimeout. For a session to a USB instrument, this function sends the READ_STATUS_BYTE command on the control pipe"


0 Kudos
Message 4 of 4