How save n retrieve picture in a application directory?

jpdbay

Active member
Joined
Feb 22, 2006
Messages
31
Programming Experience
Beginner
hi,

1. How do save a picture to application directory in a folder named "Picture" with ID number (eg. 0000001.jpg)?

2. How to read and populate the picture from the directory to PictureBox?

Currently I'm saving the picture in C:\
VB.NET:
obj.GetPicture("c:\test1.bmp")
                    PictureBox1.Image = Image.FromFile("c:\test1.bmp")

Any help with sample code wl guide me to finish my task. Thanx

Rgds,
jpdbay
 
jpdbay said:
hi,

1. How do save a picture to application directory in a folder named "Picture" with ID number (eg. 0000001.jpg)?

2. How to read and populate the picture from the directory to PictureBox?

Currently I'm saving the picture in C:\
VB.NET:
obj.GetPicture("c:\test1.bmp")
                    PictureBox1.Image = Image.FromFile("c:\test1.bmp")

Any help with sample code wl guide me to finish my task. Thanx

Rgds,
jpdbay

answer:
1)
use File.Copy(source file name, destination file name)

2)
Private Sub FileOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FileOpen.Click
OpenFileDialog1.Filter = "Images|*.GIF;*.TIF;*.JPG"
OpenFileDialog1.ShowDialog()
If OpenFileDialog1.FileName = "" Then Exit Sub
PictureBox1.Image = Image.FromFile(OpenFileDialog1.FileName)
PictureBox1.Width = PictureBox1.Height * PictureBox1.Image.Width / PictureBox1.Image.Height
Me.Text = "(" & PictureBox1.Image.Width.ToString & ", " & PictureBox1.Image.Height.ToString & ")"
End Sub
 
Back
Top