3 Replies - 2383 Views - Last Post: 08 March 2010 - 08:06 AM Rate Topic: -----

#1 ichigo_cin  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 5
  • Joined: 28-January 10

how can i display image in C#

Posted 07 March 2010 - 11:20 PM

hi to all...

i save image path file in database (microsoft access)

i don't know how to command path file to displayed image on C#

who know, plz tell me

thank for your answer.
Is This A Good Question/Topic? -1
  • +

Replies To: how can i display image in C#

#2 Sn0wBum  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 9
  • View blog
  • Posts: 178
  • Joined: 04-February 10

Re: how can i display image in C#

Posted 08 March 2010 - 03:44 AM

OpenFileDialog Class is one option to capture the file path.

Then your code might look like this
Image img;
string imgFile;
OpenFileDialog ofd = new OpenFileDialog();
ofd.InitialDirectory = "c:\\";
//You are not limited to GIF or JPEG
ofd.Filter = "Gif files (*.gif)|*.gif|JPEG Files(*.JPEG)|*.JPEG|All files (*.*)|*.*";
ofd.FilterIndex = 2;
ofd.RestoreDirectory = true;

imgFile = ofd.FileNames[0].ToString();
img = Image.FromFile(imgFile);



I did not test this code... just browsed some older syntax I have saved, so you might have to tweek it a little. :)

This post has been edited by Sn0wBum: 08 March 2010 - 07:58 AM

Was This Post Helpful? 0
  • +
  • -

#3 danny_kay1710  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 28
  • View blog
  • Posts: 358
  • Joined: 27-April 08

Re: how can i display image in C#

Posted 08 March 2010 - 05:03 AM

Try looking at an picture box and then connect to your database to retrieve the path. You then just need to set the Image property of the picture box.

[rules][/rules]
Was This Post Helpful? 0
  • +
  • -

#4 Sn0wBum  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 9
  • View blog
  • Posts: 178
  • Joined: 04-February 10

Re: how can i display image in C#

Posted 08 March 2010 - 08:06 AM

You may also need to research byte array to image conversions.
*Note this link isn't to a D.I.C. source*
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1