How can I safe the path for my graphic file that I loaded into my Image Control
1. I have a Image Control, Text Box & Common Dialog in my database form.
2. I Open the file where the pictures is saved, via the Common Dialog Control.
3. The picture is loaded into the Image Control when I click on it.
4. I saved the picture at run time into my textbox, it gives me a nr & not the actual file name and the picture is visible in the Image control .
5. I want to link the path of the picture from the text box to the image control.
6. I want to view the actual picture that I saved at Run Time in the text box.
7. The number of the picture is in the textbox at run time but the picture is not shown in the image control at run time when I restart the project.
8. How can I link the path : textbox to the picture of the picture control.
9. I don’t want to save the actual pictures in the database but just it’s deferent paths in the textbox..
10. If I go into separate data records it must show me the actual pictures which paths I saved in the textbox.
HERE IS THE CODE THAT I USED :
Dim cn As ADODB.Connection 'Connect to a Database.
Public rs As ADODB.Recordset 'Set records.
_________________________________________________________
Public Sub OpenConnection()
'Database to be opened.
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\VB\CMS\CMS.mdb"
cn.Open
End Sub
_________________________________________________________
Public Sub ReturnRecords()
'Records to be set.
Set rs = New ADODB.Recordset
OpenConnection
rs.ActiveConnection = cn
rs.Source = "SELECT * FROM [Detainee Particulars] ORDER BY Surname"
rs.CursorType = adOpenStatic
rs.LockType = adLockOptimistic
rs.Open
End Sub
_________________________________________________________
Private Sub cmdSave_Click()
rs!Photo = txtPath.Text & ""
End Sub
_________________________________________________________
I THINK MY PROBLEM IS HERE : AT RUN TIME
PopulateControls
ComDiaPhoto.FileName = rs!Photo & ""
txtPath.Text = rs!Photo & ""
If ComDiaPhoto.FileName <> "" Then
ImgPhoto.Picture = LoadPicture(ComDiaPhoto.FileName)
End If
End if
1. I have a Image Control, Text Box & Common Dialog in my database form.
2. I Open the file where the pictures is saved, via the Common Dialog Control.
3. The picture is loaded into the Image Control when I click on it.
4. I saved the picture at run time into my textbox, it gives me a nr & not the actual file name and the picture is visible in the Image control .
5. I want to link the path of the picture from the text box to the image control.
6. I want to view the actual picture that I saved at Run Time in the text box.
7. The number of the picture is in the textbox at run time but the picture is not shown in the image control at run time when I restart the project.
8. How can I link the path : textbox to the picture of the picture control.
9. I don’t want to save the actual pictures in the database but just it’s deferent paths in the textbox..
10. If I go into separate data records it must show me the actual pictures which paths I saved in the textbox.
HERE IS THE CODE THAT I USED :
Dim cn As ADODB.Connection 'Connect to a Database.
Public rs As ADODB.Recordset 'Set records.
_________________________________________________________
Public Sub OpenConnection()
'Database to be opened.
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\VB\CMS\CMS.mdb"
cn.Open
End Sub
_________________________________________________________
Public Sub ReturnRecords()
'Records to be set.
Set rs = New ADODB.Recordset
OpenConnection
rs.ActiveConnection = cn
rs.Source = "SELECT * FROM [Detainee Particulars] ORDER BY Surname"
rs.CursorType = adOpenStatic
rs.LockType = adLockOptimistic
rs.Open
End Sub
_________________________________________________________
Private Sub cmdSave_Click()
rs!Photo = txtPath.Text & ""
End Sub
_________________________________________________________
I THINK MY PROBLEM IS HERE : AT RUN TIME
PopulateControls
ComDiaPhoto.FileName = rs!Photo & ""
txtPath.Text = rs!Photo & ""
If ComDiaPhoto.FileName <> "" Then
ImgPhoto.Picture = LoadPicture(ComDiaPhoto.FileName)
End If
End if