4 Replies - 1136 Views - Last Post: 04 May 2013 - 09:44 AM Rate Topic: -----

#1 isabelai  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 08-April 13

how can add an image to a form

Posted 08 April 2013 - 11:44 PM

may you please help me..
im trying to figure out a code that will display on the picturebox a selected picture..
this is what i want to happened
when i run the code and click on the picturebox, the my documents will appear there i can choose the desired picture..

im so confused with the codes that im searching in the net..i hope you can help me with this..thanks in advance :)

Is This A Good Question/Topic? 0
  • +

Replies To: how can add an image to a form

#2 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 300
  • View blog
  • Posts: 1,770
  • Joined: 26-March 09

Re: how can add an image to a form

Posted 09 April 2013 - 01:50 AM

Please post the code you already have and explain what you're having difficulty understanding.

Use the code tags as explained in the reply box background so your code will be formatted.
Was This Post Helpful? 0
  • +
  • -

#3 Neku  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 268
  • Joined: 21-May 09

Re: how can add an image to a form

Posted 09 April 2013 - 10:06 AM

use the windows common dialog control and use it's Open methood to select the file you want to open.
you can add filters so only bmp files or gif will be shown.
after that take the command dialog FileName property and put it in the

Picturebox.picture=LoadPicture(FileName)



note: picturebox does not support all image formats
Was This Post Helpful? 0
  • +
  • -

#4 subrataroy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 02-May 13

Re: how can add an image to a form

Posted 03 May 2013 - 04:59 AM

components->Microsoft common Dialog control 6.0
apply in your form.
drag and drop image control and command button in your form
Private Sub browsecmd_Click()
CommonDialog1.ShowOpen
Image1.Picture = LoadPicture(CommonDialog1.FileName)
End Sub


Was This Post Helpful? 0
  • +
  • -

#5 Neku  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 268
  • Joined: 21-May 09

Re: how can add an image to a form

Posted 04 May 2013 - 09:44 AM

View Postsubrataroy, on 03 May 2013 - 01:59 PM, said:

components->Microsoft common Dialog control 6.0
apply in your form.
drag and drop image control and command button in your form
Private Sub browsecmd_Click()
CommonDialog1.ShowOpen
Image1.Picture = LoadPicture(CommonDialog1.FileName)
End Sub



no its not like that.
first what if the user click cancel in the opening window? it best you'll get
empty string for a file name and no picture will be displayed, most likely the program will crash
also you need to give a filter for the file type, the picturebox control don't support all image file types and its obviouse you cant open txt file with it.
you also need to check that the path is valid or again the program will crash.

do some research on the CommonDialog control
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1