如何从datagridview检索图像到picturebox vb.net

时间:2017-01-22 05:43:56

标签: vb.net datagridview

  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 img As Byte
        img = dg1.Item(7, e.RowIndex).Value
        Dim ms As New MemoryStream(img)
        pb1.Image = Image.FromStream(ms)
        txtPIC.Text = dg1.Item(8, e.RowIndex).Value
    End Sub

0 个答案:

没有答案