i successfully saved picture file as pathfile to database but i do not know how to open this picture file by relevant program suh as internet explorer, acdsee or else?

Recommended Answers

All 7 Replies

Hi,

Add a Picture box Control on the form and use this code:

Picture1.Picture = LoadPicture("C:\Mypict.bmp")

Regards
Veena

Thank you for your quick respond.

Just give the details:
I made a form to input data contains pathfile of picture in datagrid table as below:

D:\ADR Files\MCC & Tooling Cost\MCC Image\MCC.jpg

Then i would like to open this image by using another picture program such as internet explorer, bitmap or else. Therefore by double clicking row in datagrid this image will be opened by another program not be shown on picture box of visual basic.

I have link pathfile by choose hyperling on database (access) and can open it. But i have know yet how to open it in vb form.
Should i did some stupid mistake procedure, could you pls tell me hoe to make it easier?

thanks in adavance
Orvet

Hi,

in case if u dont want to use the PictBox, shell out the image;

Shell "C:\WINDOWS\SYSTEM32\MSPAINT.EXE " & Chr(34) & "C:\MyPict.BMP" & Chr(34), vbMaximizedFocus

U can also Shell JPG/GIF Files also in the same way.
I feel its a better option to Show the Image in a PictureBox on another Form in the same project.

Regards
Veena

Actually i have prepared data grid where picture file saved in pathfile not a picture. Then i made a new form to browse data and to call that picture saved. When i compiled this form, we couldn't open that picture using another windows program because there is only pathfile not a picture in datagrid table.

I gave command button to call this picture , then problem came out as object not identified. I assumed that data grid can not show link of picture file to the its source.

Should you need the details of my project , i ll give you by email.
It is important for me to finish this job because our company needs online database for computing material cost and show them to any viewer.

By the way we can not specify picture file in one name, but i need to provide relation every picture file refer to picture number. therefore i can not make procedure for single picture only.

should you have any suggestion pls let me know.
thank you
Orvet

Hi,

OK.. ur pict is not stored in the db, To show the Picture in another Form, it is simple..
First Add a Public Variable to the Form and in either Click Event of the Grid or Command button, populate the public variable with the Path and Show the Second Picture Form. Some thing like this:
Add a Form (frmPict). Place a pictureBox on this form, write this code in Main/Calling form..
Declare this Variable FormLevel:
Public MyPath As String

MyPath = DataGrid1.Columns(5).Text
  frmPict.Show

Write this code in frmPict FormLoad Event:

Me.Picture1.Picture = LoadPicture(Form1.MyPath)

Where as Form1 is the Main Form where datagrid is Loaded.. Change it to ur Form name..

Regards
Veena

i tried and it works but picture can not be shown, i only see empty picture box even there is pathfile in datagrid column.

Assuming that datagrid1.column(5) contains pathfile: d:\images\mcc.jpg.
hw to open this image by calling pathfile. is there any procedure must be created? what kind of type should we define for database column where saved pfthfile? hyperlink , OLEobject or text?

if we can oen picture, how to view picture by default application?
thank you

try to use the OLE Object datatype for your picture in the database. it will save the picture, ergo you need not the path of your picture.

Be a part of the DaniWeb community

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