Saving Images with filename to specific directory in C#

Hey community,

i want to save an Image with a predefined filename (out of a Textbox, like a serial Number) to a specific folder in C#!
Actually following thing is working fine;

axCVimage1.SaveImageByUserDialog("", “Save Image”, “CVC Image Format (.bmp)|.bmp”);

But this is not what i want - i found in , ImageManager: under Methods: boolean SaveImage ( BSTR Filename )

I think that is what i need, but i don’t know how to handle with it (I’m a beginner…). I need to put ,string filename" inside (), but how can i take name out of textbox (e.g.: textBoxName) and save it to a path (e.g.: C:\Images\Grabs).

The example code (,Loadimage", …should be the same…) ,Visual Basic - VB Fileformats Example" is not existing in my folders :frowning:

Thank u all!

André

1 Like

Hi @Andre89 and welcome to the :cvb: family :slight_smile:

You can get the content of your TextBox from its Text property and then use the string as an input for the Save method of the image OCX. If you call your TextBox e.g. “textBoxSavePath” it would look like this:

axCVimage1.SaveImage(textBoxSavePath.Text);

I hope this helps!

Cheers
Thomas

3 Likes

Hi @Andre89,

and to save it to the right location you can for example just concatenate the strings like this:

axCVimage1.SaveImage("C:\\Images\\Grabs\\" + textBox1.Text + ".bmp");

regards
Arno

2 Likes

Hey rtp_derash and Arno,

thank you sooo much!

Saving and loading driver from a path is working right now :slight_smile:

There is one question left, but it doesn’t fit to the topic:
How can i load the complete GenIcam Device Nodemap Window , while livegrabbing? I need to optimize the settings for a better view at any time. Should i open a new topic?

Thanks!

Its always better to have only one subject discussed in each topic :wink: But anyway:
The nodemap can be added to the GUI just like every other ActiveX control:

grafik

You can find an example application using the GenICam nodemap under %CVB%Tutorial\Hardware\GenICam\CSharp\CSGenICamExample

1 Like

Hi @Andre89,

if you are starting from scratch with cvb it would be a good idea to start with our new cvb.net wrappers. Here is a good getting started guide: Getting Started with CVB.Net

Regards
Arno

3 Likes