如何使用vb.net保存和检索ms访问中的图像

时间:2017-01-22 17:36:54

标签: vb.net image ms-access

请某人帮助我。我无法从datagridview获取图像。转移到图片框。我已经使用长二进制数据格式以ms访问保存图像。提前谢谢。

Private Sub dg1_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dg1.CellDoubleClick

    On Error Resume Next
    tVN.Text = dg1.Item(0, e.RowIndex).Value
    tNme.Text = dg1.Item(1, e.RowIndex).Value
    tCN.Text = dg1.Item(2, e.RowIndex).Value
    tAdd.Text = dg1.Item(3, e.RowIndex).Value
    tVT.Text = dg1.Item(4, e.RowIndex).Value
    tTI.Text = dg1.Item(5, e.RowIndex).Value
    tTO.Text = dg1.Item(6, e.RowIndex).Value
    Dim ms As New MemoryStream
    Dim img As Bitmap
    img = dg1.CurrentRow.Cells(7).Value
    img.Save(ms, ImageFormat.Jpeg)
    pb1.Image = Image.FromStream(ms)
    txtPIC.Text = dg1.Item(8, e.RowIndex).Value

End Sub

0 个答案:

没有答案