Hola mi gente buena. necesitO ayuda de ustedes con suma urgencia. el codigo que muestro a continuacion es el que utilizo para guardar una foto. ok
Código:
Dim rs As New ADODB.Recordset
Dim iChunks As Integer
Dim arrPic() As Byte
Dim lngSize As Long
Dim intChunks As Integer
Dim intFragment As Integer
Dim sPathPic As String
sPathPic = cdImagen.FileName
rs.Open "SELECT * FROM registro", nc, adOpenDynamic, adLockOptimistic
rs.AddNew
rs!codigo = CLng(lbCodigo.Caption)
rs!Cedula = cCedula1.DevolverCedula()
rs!nombre = TxtNombre.Text
rs!cargo = CboCargo
rs!direccion = CboDireccion
'Abrimos el archivo donde está la imagen.
Open sPathPic For Binary As #1
lngSize = LOF(1)
If (lngSize = 0) Then
MsgBox "Error, Imágen incorrecta", vbInformation, "Atencion"
rs.Close
Set rs = Nothing
Exit Sub
End If
intChunks = (lngSize \ 1024)
intFragment = (lngSize Mod 1024)
ReDim arrPic(intFragment) As Byte
Get #1, , arrPic()
rs("foto").AppendChunk arrPic
ReDim arrPic(1024)
For iChunks = 1 To intChunks
Get 1, , arrPic()
rs("foto").AppendChunk arrPic()
Next iChunks
rs.Update
Close #1
rs.Close
Set rs = Nothing
MsgBox "Se agrego un nuevo registro a la lista", vbInformation, "Guardado"
'actualizamos la lista
Call formPrincipal.Cargar_Registro
Call Generar_Codigo
'se cierra el formulario y se limpian los campos.
Unload Me
---> entonces. tengo un formulario que se llama frmPrincipal. (aqui me muestran los datos en un listview) yo al darle doble clic esos datos me los carga en otro formulario que se llama formAgregar. entonces quiero que la foto que se cargue alli me la muestre en el formAgrega. no se como hacer.. me ayudan ?
Código:
Private Sub Editar()
Dim i As Integer
' verifica que hay datos en el ListView y que hay uno seleccionado
If (lv.ListItems.Count = 0) Then
MsgBox "No hay ningún regisro para ver en vista previa", vbInformation
Exit Sub
End If
If (lv.SelectedItem Is Nothing) Then
MsgBox "Debe seleccionar previamente un registro para poder verlo", vbInformation
Exit Sub
End If
With FormAgregar
' obtiene el elemento seleccionado
.lbCodigo = lv.SelectedItem.Text
For i = 1 To 4
.lbCedula.Caption = lv.SelectedItem.ListSubItems(i).Text
Next
.lbCedula = lv.SelectedItem.ListSubItems(1).Text
.TxtNombre = lv.SelectedItem.ListSubItems(2).Text
.CboCargo = lv.SelectedItem.ListSubItems(3).Text
.CboDireccion = lv.SelectedItem.ListSubItems(4).Text
.lbCodigo = lv.SelectedItem.Text
Call Juego_de_Controles
.Show vbModal
End With
End Sub

