I creating a small program which basically reads Electronic identity cards and stores the information in a SQL database.
There is more to the program of course, but this is where i need help with.

The EID has a picture from the person also.
I decided not to save the image directly into the SQL database, but store it in the application directory.
However i cannot seem to figure out how i can save it with a filename taken from one or more textboxes.

This is what i am using right now, but as you can see it saves it as Test.Jpeg

        Dim file_name As String = Application.ExecutablePath
        file_name = file_name.Substring(0, _
            file_name.LastIndexOf("\bin")) & "\test."
        Dim bm As Bitmap = EidPic.Image
        bm.Save(file_name & "jpg", _

I am thinking it would be the easiest if i stored the picture with a filename which is less common.
For example the ID card number or social security number, since these are always unique.

Any help would be appreciated.


Recommended Answers

All 4 Replies

Assuming you have the card number stored in a variable named EIDCardNo, just replace your line

file_name.LastIndexOf("\bin")) & "\test."


file_name.LastIndexOf("\bin")) & "\" & EIDCardNo & "."

Well once i click the read button it will first collect all data from the card.
And puts it in the textboxes, at this point its still not saved.
So i want it to get the text/numbers from the EIDCard number textbox and use that as name to save the imageonce i go to the next step, which will also save to the database.
So the name is taken from the EIDCardNr.text.

In that case use

file_name.LastIndexOf("\bin")) & "\" & EIDCardNr.Text & "."

Works like a charm, thanks a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.