Measurement Studio for .NET Languages

Showing results for 
Search instead for 
Did you mean: 

Save an image in .NET

Go to solution

I am completely new to .NET programming, zero experience, and I currently don't want to get into any deep programming with it. That said I have been thrown into the world of .NET by the need to use a camera which uses it in LabView. 

What I'm looking to do is save an image from the picture box. The image below shows the error I'm running into, error 1172. Looking this up I get information about my registry files, do a disk clean up, and need to clear out my temporary folders and what not. Further searching lead to some people talking about trust levels and needing a rank of 8 to work properly and that comepletely confuzzled me.

The software and VI packages that build up the VI that I'm using can be found at:

From the attached image the vi that I'm using is I do see the documentation on the website I've linked and I've had a look at the LabView .NET documentation which has provided absolutely no use. It did mention that you should close off the .NET reference after it's been used to save memory however I don't fully understand why.

I appreciate any advice that you care to share as currently the only thing working in this is the creation of a .bmp file shell.

0 Kudos
Message 1 of 4



My name is Ed from National Instruments Applications Engineering. I have been forwarded your forum post with regards to .NET and saving images. I was able to develop the attached example, to which I did find similar errors to yourself, eventually I found that you need to have created the image file to which you are saving too, prior to then writing to the image.


This is similar to that you are creating the image programmatically, so I believe the reason for your error is that the image is not being created prior to save. There is no enforcement of the data flow and hence a race condition occurs, additionally you do not close the handle to the file. I would encapsulate your code in a sequence frame whereby you enforce that the Image.Save method is not called until after the file has been created and then the handle closed.


Best regards,



Message 2 of 4
Accepted by topic author Plant_Boy


Thank you for your reply!

I managed to solve the problem by calling Camera.Memory.[GetList/idList]. I took the first(0) array value from Camera.Memory.idList.


I called Camera.Memory.[CopyToArray/s32MemId/u8Image] and fed the array value from idList[0] into s32MemId. I took the u8Image out and fed it into a special "uEye Array to Image" VI, which also referenced .NET camera, to output an image.

I converted this using a Picture to Pixmap type and saved it with a Write BMP

I'm not sure entirely what I've created but it works! I am going to look at your model as I'm getting quite interested now that I've gotten a footing in understanding .NET. It'll be interesting to see how someone else solved the problem!

Edit: Attachement Attached. Not sure if it'll work, as it uses a particular vi that I don't think LabView normally accomodates.

0 Kudos
Message 3 of 4


thank you for sharing your program.

I work on an IDS camera, and I want to acquire several images in a row with a timestamp.

have you an idea to do that?


Many thank,


0 Kudos
Message 4 of 4