(a) Create a database file (MS ACCESS) having a DATAFIELD name (say image1).
(b) Place a DATA component (say DATA1) in main vb form. Select this DATA1 component and then select database name property and browse for above MS ACCESS file and select to open the file. This will save the file path.
(c) Place a text box (say text8) in vb form and set it's visible property to false. Also, select DATASOURCE property
(say DATA1) and DATAFIELD(say image1).
(d) Place a common dialog box in your form (say commondialog1).
(e) Place an image box component in your form (say image1)
(f) Now, this simple code will load and save any image present in your hard disk:
Private Sub Command4_Click()
Form1.CommonDialog1.Filter = "JPG Files|*.jpg|BMP Images|*.bmp|GIF Images|*.gif"
On Error Resume Next
Form1.CommonDialog1.ShowOpen
On Error Resume Next
Form1.CommonDialog1.CancelError = True
Form1.Text8.Text = Form1.CommonDialog1.FileName
a = Form1.Text8.Text
Form1.Image1.Picture = LoadPicture(a)
End Sub
Walang komento:
Mag-post ng isang Komento